commit 5a69e1c0ce9fe67df09d4afbef263c326035172a Author: Triston Armstrong Date: Sun Nov 10 08:58:16 2024 -0500 init commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b1ee42 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/apps.sh b/apps.sh new file mode 100755 index 0000000..0377653 --- /dev/null +++ b/apps.sh @@ -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; diff --git a/cli.sh b/cli.sh new file mode 100755 index 0000000..b5dec22 --- /dev/null +++ b/cli.sh @@ -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; + diff --git a/dots.sh b/dots.sh new file mode 100755 index 0000000..885ebb2 --- /dev/null +++ b/dots.sh @@ -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; diff --git a/error.sh b/error.sh new file mode 100755 index 0000000..ac1da03 --- /dev/null +++ b/error.sh @@ -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 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..be3b826 --- /dev/null +++ b/install.sh @@ -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; diff --git a/non_pac.sh b/non_pac.sh new file mode 100755 index 0000000..c3cfc99 --- /dev/null +++ b/non_pac.sh @@ -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; diff --git a/post_setup.sh b/post_setup.sh new file mode 100755 index 0000000..24f2a40 --- /dev/null +++ b/post_setup.sh @@ -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 diff --git a/success.sh b/success.sh new file mode 100755 index 0000000..dc0067c --- /dev/null +++ b/success.sh @@ -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 + diff --git a/warn.sh b/warn.sh new file mode 100755 index 0000000..384ba1c --- /dev/null +++ b/warn.sh @@ -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