From bae1e762fd277548e78e73ab72750bd3d1a1f9e2 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 7 May 2025 18:53:26 -0400 Subject: [PATCH] starting work on updated scripts as part of my migration to debian servers --- setup/0-pre-config.sh | 26 ++++++++++++ setup/1-choose-packages.sh | 87 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100755 setup/0-pre-config.sh create mode 100755 setup/1-choose-packages.sh diff --git a/setup/0-pre-config.sh b/setup/0-pre-config.sh new file mode 100755 index 0000000..59ec291 --- /dev/null +++ b/setup/0-pre-config.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +read -p 'Install git and vim? [y/N]: ' response +case "${response}" in + [Yy]* ) + # before we can begin, we need what should have already been installed + sudo apt install git vim -y + ;; + * ) + echo 'Skipping' + ;; +esac +echo '' + +read -p 'Enable available aliases within your ~/.bashrc? [y/N]: ' response +case "${response}" in + [Yy]* ) + # enable available aliases + sed -i -e 's/#alias/alias/g' "${HOME}/.bashrc" + ;; + * ) + echo 'Skipping' + ;; +esac +echo '' + diff --git a/setup/1-choose-packages.sh b/setup/1-choose-packages.sh new file mode 100755 index 0000000..9b8584b --- /dev/null +++ b/setup/1-choose-packages.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +called_update=false +script_dir=$(dirname "$0") + +# ---------------------------------------------------------- + +function install_collection () { + read -p "Install $1? [y/N]: " response + case "${response}" in + [Yy]* ) + if [ "${called_update}" = false ]; then + echo 'Updating APT before Installing' + sudo apt update + called_update=true + fi + echo "Installing $1" + sudo apt install "${@:2}" -y + ;; + * ) + echo 'Skipping' + ;; + esac + echo '' +} + +# ---------------------------------------------------------- + +install_collection 'core utilities: (curl, python3, jq, htop, etc.)' curl fail2ban git htop jq grep gzip net-tools goaccess dnsutils bash-completion cron vim make chrony build-essential gcc inotify-tools python3 python-is-python3 screen bc + +# ---------------------------------------------------------- + +install_collection 'extra utilities: (ncdu, zip, php, rclone, etc.)' ncdu zip unzip iftop colorized-logs php-cli ca-certificates gnupg lsb-release rclone + +# ---------------------------------------------------------- + +read -p 'Install Node.js v22? [y/N]: ' response +case "${response}" in + [Yy]* ) + sudo "${script_dir}/../nodejs-install/nodesource_setup.sh" + sudo apt install nodejs -y + ;; + * ) + echo 'Skipping' + ;; +esac +echo '' + +# ---------------------------------------------------------- + +echo "----- Install NodeJS Apps Yarn and HttpServer -------" +read -p 'Install NodeJS Apps "yarn" and "http-server" globally? [y/N]: ' node_more +case $node_more in + [Yy]* ) + echo "----- Installing NodeJS 'yarn' globally -------------" + sudo npm install --global yarn + echo "----- Installing NodeJS 'http-server' globally ------" + sudo npm install --global http-server + echo "----- Completed NodeJS Apps -------------------------" + ;; + * ) + echo 'Skipping' + ;; +esac + +echo "----- Install Go Lang -------------------------------" +read -p 'Install Go Lang? [y/N]: ' go_lang +case $go_lang in + [Yy]* ) + echo "----- Determining current stable go version ---------" + # load json file with version info, filter to only stable versions, take the first (newest), strip to just numeric + go_version=$(wget --quiet --output-document - 'https://go.dev/dl/?mode=json' | jq -r '.[] | select( .stable ) | .version' | head -n 1 | sed 's/[^0-9.]*//g') + if [[ -n "$go_version" ]]; then + version_flag='--version' + echo "Installing Go Version: $go_version" + fi + + echo "----- Calling Go Install Script ---------------------" + LOCATION=`dirname "$0"` + "${LOCATION}/../golang-install/goinstall.sh" "$version_flag" "$go_version" + echo "----- Completed Go Install Script -------------------" + ;; + * ) + echo 'Skipping' + ;; +esac +