init commit

This commit is contained in:
Triston Armstrong 2024-11-10 08:58:16 -05:00
commit 5a69e1c0ce
10 changed files with 381 additions and 0 deletions

175
.gitignore vendored Normal file
View File

@ -0,0 +1,175 @@
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
# Logs
logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Caches
.cache
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
# Runtime data
pids
_.pid
_.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# IntelliJ based IDEs
.idea
# Finder (MacOS) folder config
.DS_Store

36
apps.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
main(){
run_apps_install;
}
_install_app(){
local name=$1; # looks like com.microcrap.garbage
local app_name_extracted=$(echo "$name" | awk -F"." "{ $3 }");
if ! command -v "$app_name_extracted" &> /dev/null; then
bash ./warn.sh "Installing ... $app_name_extracted"
flatpak install flathub "$name" --assumeyes
bash ./success.sh "$app_name_extracted installed successfully"
else
bash ./warn.sh "$app_name_extracted already installed"
fi
}
run_apps_install(){
echo "########################### App Installations #######################"
local flatpak_apps=(
"com.microsoft.Edge"
"io.github.zen_browser.zen"
"dev.vencord.Vesktop"
"org.blender.Blender"
"org.godotengine.Godot"
"de.haeckerfelix.Shortwave"
)
for i in "${flatpak_apps[@]}"; do
_install_app "${i}";
done;
}
main;

37
cli.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
main(){
run_cli_install;
}
_install_cli(){
local name=$1;
bash ./warn.sh "Installing cli tool: $name" # v---- this skips already installed stuff
if (sudo pacman -S --needed "$name" --noconfirm >>/dev/null); then
bash ./success.sh "Successfully installed cli tool: $name"
else
bash ./error.sh "Failed: $name"
fi
}
run_cli_install(){
echo "########################### Cli Tools #######################"
local cli_tools=(
"git"
"vim"
"helix"
"typescript"
"typescript-language-server"
"bash-language-server"
"mingw-w64-x86_64-clang" # <-- expect failure
"flatpak"
"fish" # <-- shell
)
for i in "${cli_tools[@]}"; do
_install_cli "$i";
done;
}
main;

47
dots.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
main(){
run_dotfiles_install;
}
_install_dotfiles(){
local out=$1; local url=$2; local post=$3;
bash ./warn.sh "Fetching $out ..."
if (curl "$url" -o "$out" --create-dirs);then
bash ./success.sh "Success: $out"
if [[ "$post" ]]; then
eval "$post"
fi
else
bash ./error.sh "Failed: $out"
fi
}
run_dotfiles_install(){
echo "########################### Dot Files #######################"
declare -A vim=(
["out"]="$HOME/.vimrc"
["url"]="http://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.vimrc"
["post"]="vim -es -u vimrc -i NONE -c "PlugInstall" -c "qa"" # <-- runs pluginstall after
)
declare -A helix_config=(
["out"]="$HOME/.config/helix/config.toml"
["url"]="https://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.config/helix/config.toml"
["post"]=""
)
declare -A helix_languages=(
["out"]="$HOME/.config/helix/languages.toml"
["url"]="https://git.klectr.dev/tristonarmstrong/dotfiles/raw/branch/main/.config/helix/languages.toml"
["post"]=""
)
dotfiles+=("vim" "helix_config" "helix_languages")
for tuple_name in "${dotfiles[@]}"; do
declare -n tuple="$tuple_name"
_install_dotfiles "${tuple["out"]}" "${tuple["url"]}" "${tuple["post"]}";
done;
}
main;

8
error.sh Executable file
View File

@ -0,0 +1,8 @@
error(){
local txtred=$(tput setaf 1) # Red
local txtwht=$(tput setaf 7) # White
local msg=$*
echo "$txtred $msg $txtwht"
}
error $1

26
install.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# TODO should be applicable to other package managers (dnf, apt, ..)
main(){
_update_pac
bash ./dots.sh;
bash ./cli.sh;
bash ./non_pac.sh;
bash ./apps.sh;
bash ./post_setup.sh;
}
_update_pac(){
sudo pacman -Fy --noconfirm
sudo pacman -Syu --noconfirm
}
main;

28
non_pac.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
main(){
run_non_pac_install;
}
_install_non_pacman(){
local name=$1; local cmd=$2; local post=$3;
if ! command -v "$name" &> /dev/null
then
echo "$name Not installed.. installing";
eval "$cmd"
if [[ "$post" ]]; then
eval "$post"
fi
else
echo "$name already installed";
fi
}
run_non_pac_install(){
echo "########################### Non Pacman #######################"
_install_non_pacman "bun" "curl -fsSL https://bun.sh/install | bash;" # no third arg here
_install_non_pacman "starship" "curl -sS https://starship.rs/install.sh | sh" "echo \"eval \$(starship init bash)\" >> ~/.bashrc"
_install_non_pacman "vim-plug" "curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
}
main;

7
post_setup.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
xdg-settings set default-web-browser io.github.zen_browser.zen.desktop
sudo chsh -s /bin/fish
sudo usermod -s /bin/fish $USER
fish

9
success.sh Executable file
View File

@ -0,0 +1,9 @@
success(){
local txtgrn=$(tput setaf 2) # Green
local txtwht=$(tput setaf 7) # White
local msg=$*;
echo "$txtgrn $msg $txtwht"
}
success $1

8
warn.sh Executable file
View File

@ -0,0 +1,8 @@
warn(){
local txtylw=$(tput setaf 3) # Yellow
local txtwht=$(tput setaf 7) # White
local msg=$*
echo "$txtylw $msg $txtwht"
}
warn $1