From 833384d06cf03c318041a01c23fd497f4ca924fd Mon Sep 17 00:00:00 2001 From: Tristan Williams Date: Sun, 13 Oct 2024 16:26:51 -0400 Subject: Massive change, fuck it Reworked some of the logic of the installer to give the user options for each section. Also added package installation section because why not. Bad commit. Multiple things. Oh well. --- new-user-setup.sh | 126 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 91 insertions(+), 35 deletions(-) diff --git a/new-user-setup.sh b/new-user-setup.sh index 18d020a..adac48b 100755 --- a/new-user-setup.sh +++ b/new-user-setup.sh @@ -47,22 +47,57 @@ ENDCOLOR="\e[0m" echo "### Starting dotfiles.core installation... ###" # Warn user about dependencies -echo "" -echo "${WARN}WARNING: This installer assumes that dotfiles.sys and all sys-level packages have been installed.${ENDCOLOR}" -echo "[A]bort, [C]ontinue" +echo -e "${WARN}WARNING: This installer assumes dotfiles.sys and sys-level packages have been installed. [A]bort, [C]ontinue: ${ENDCOLOR}" echo -en "\033[1A\033[1000C" read -n1 confirm +confirm_invalid_selection=0 while case $confirm in "a"|"A") + echo "INFO : Abort!" exit 0;; "c"|"C") break;; *) echo -e "${WARN}ERROR : Invalid selection, try again...${ENDCOLOR}" - invalid_selection=1;; + confirm_invalid_selection=1;; esac - [[ $invalid_selection==1 ]] + [[ $confirm_invalid_selection==1 ]] +do true; done + + +######################################################################## +## Install Packages +######################################################################## +echo "INFO : Proceed with package installation? Requires sudo privileges [y/n]: " +echo -en "\033[1A\033[1000C" +read -n1 do_package_install +package_invalid_selection=0 +while + case $do_package_install in + "y"|"Y") + sudo pkg update + sudo pkg upgrade && sudo pkg install \ + audio/dsbmixer \ + audio/gtk-mixer \ + graphics/drm-kmod \ + graphics/ImageMagick7 \ + graphics/poppler-glib \ + mail/isync \ + www/firefox \ + x11/arandr \ + x11-fonts/nerd-fonts \ + x11/xorg + echo "INFO : Packages installed and updated." + break;; + "n"|"N") + echo "INFO : Skipping package installation and updates." + break;; + *) + echo -e "${WARN}ERROR : Invalid selection, try again...${ENDCOLOR}" + package_invalid_selection=1;; + esac + [[ $package_invalid_selection==1 ]] do true; done @@ -164,36 +199,57 @@ place_directory () { fi } -# Create user dir skeleton -place_directory $HOME/bin - -# Bash Configuration -place_file $HOME/dotfiles.core/home/.bash_profile $HOME/.bash_profile -place_file $HOME/dotfiles.core/home/.bashrc $HOME/.bashrc -place_file $HOME/dotfiles.core/home/.bash_aliases $HOME/.bash_aliases - -# GPG Configuration -place_directory $HOME/.gnupg/ -place_file $HOME/dotfiles.core/home/.gnupg/gpg-agent.conf $HOME/.gnupg/gpg-agent.conf - -# Git configuration -place_file $HOME/dotfiles.core/home/.gitconfig $HOME/.gitconfig -echo -e "${WARN}WARNING: ~/.gitconfig.local should be placed manually${ENDCOLOR}" - -# Common Lisp SBCL Configuration -place_file $HOME/dotfiles.core/home/.sbclrc $HOME/.sbclrc -place_directory $HOME/lisp -# Install Quicklisp -if [[ ! -d $HOME/lisp/quicklisp ]]; then - curl -o /tmp/ql.lisp http://beta.quicklisp.org/quicklisp.lisp - sbcl --no-sysinit --no-userinit --load /tmp/ql.lisp \ - --eval '(quicklisp-quickstart:install :path "~/lisp/quicklisp")' \ - --quit \ - > /dev/null # minimize output - echo -e "${GREEN}INFO : Installed Quicklisp${ENDCOLOR}" -else - echo -e "${YELLOW}Skipped: Quicklisp. Already installed${ENDCOLOR}" -fi +# Place files +echo "INFO : Proceed with dotfiles installation? [y/n]: " +echo -en "\033[1A\033[1000C" +read -n1 do_dotfiles_install +dotfiles_invalid_selection=0 +while + case $do_dotfiles_install in + "y"|"Y") + # Create user dir skeleton + place_directory $HOME/bin + + # Bash Configuration + place_file $HOME/dotfiles.core/home/.bash_profile $HOME/.bash_profile + place_file $HOME/dotfiles.core/home/.bashrc $HOME/.bashrc + place_file $HOME/dotfiles.core/home/.bash_aliases $HOME/.bash_aliases + + # GPG Configuration + place_directory $HOME/.gnupg/ + place_file $HOME/dotfiles.core/home/.gnupg/gpg-agent.conf $HOME/.gnupg/gpg-agent.conf + + # Git configuration + place_file $HOME/dotfiles.core/home/.gitconfig $HOME/.gitconfig + echo -e "${WARN}WARNING: ~/.gitconfig.local should be placed manually${ENDCOLOR}" + + # Common Lisp SBCL Configuration + place_file $HOME/dotfiles.core/home/.sbclrc $HOME/.sbclrc + place_directory $HOME/lisp + # Install Quicklisp + if [[ ! -d $HOME/lisp/quicklisp ]]; then + curl -o /tmp/ql.lisp http://beta.quicklisp.org/quicklisp.lisp + sbcl --no-sysinit --no-userinit --load /tmp/ql.lisp \ + --eval '(quicklisp-quickstart:install :path "~/lisp/quicklisp")' \ + --quit \ + > /dev/null # minimize output + echo -e "${GREEN}INFO : Installed Quicklisp${ENDCOLOR}" + else + echo -e "${YELLOW}Skipped: Quicklisp. Already installed${ENDCOLOR}" + fi + echo "INFO : Configuration files placed!" + break;; + "n"|"N") + echo "INFO : Skipping configuration file placement." + break;; + *) + echo -e "${WARN}ERROR : Invalid selection, try again...${ENDCOLOR}" + dotfiles_invalid_selection=1;; + esac + [[ $dotfiles_invalid_selection=1 ]] +do true; done + + ######################################################################## ## END OF SCRIPT -- cgit v1.2.3