diff --git a/.config/bootstrap/install.sh b/.config/bootstrap/install.sh index b8e3e3a..b2234c9 100644 --- a/.config/bootstrap/install.sh +++ b/.config/bootstrap/install.sh @@ -16,14 +16,14 @@ while getopts ":a:r:p:u:U:f:F:hq" o; do case "${o}" in F) progsfile=${OPTARG} && exclusiveprogsfile=true ;; t) targetdeployment=${OPTARG} ;; u) targetuser=${OPTARG} ;; - U) targetpassword=${OPTARG} ;; + U) targetuser=${OPTARG} && forceuser=true ;; + p) targetpassword=${OPTARG} ;; q) quietmode=true;; *) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;; esac done # DEFAULTS: [ -z "$dotfilesrepo" ] && dotfilesrepo="https://gitlab.com/marty-oehme/dotfiles.git" -[ ! "$exclusiveprogsfile" ] && progsfile="$(curl -Ls https://gitlab.com/marty-oehme/dotfiles/snippets/1828258/raw | cat ) $progsfile" [ -z "$aurhelper" ] && aurhelper="yay" ### FUNCTIONS ### @@ -109,6 +109,16 @@ aurinstall() { \ sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1 } +# get the link to the package collection +getpackagegrouplink() { + case "$1" in + "none") pkggroup="";; + "desktop") pkggroup="https://gitlab.com/marty-oehme/dotfiles/snippets/1828258/raw" ;; + "laptop") pkggroup="https://gitlab.com/marty-oehme/dotfiles/snippets/1828258/raw" ;; + "headless") pkggroup="https://gitlab.com/marty-oehme/dotfiles/snippets/1828258/raw" ;; + esac +} + # can be called with as many csv files filled with packages as necessary # appends them all to one temporary file for the installation gatherpackages() { @@ -223,11 +233,20 @@ sed -i "s/-j2/-j$(nproc)/;s/^#MAKEFLAGS/MAKEFLAGS/" /etc/makepkg.conf manualinstall $aurhelper || error "Failed to install AUR helper." +# the command that sets the correct link to gather our package files from +getpackagegrouplink $targetdeployment + +# append the default packages to whatever custom package csv links were passed in or +# only use the custom packages if forced with -F +[ ! "$exclusiveprogsfile" ] && progsfile="$(curl -Ls $pkggroup | cat ) $progsfile" + +# actually gather the individual package installation lines from the various links and files +gatherpackages $progsfile + # The command that does all the installing. Reads the progs.csv file and # installs each needed program the way required. Be sure to run this only after -# the user has been created and has priviledges to run sudo without a password +# the user has been created and has privileges to run sudo without a password # and all build dependencies are installed. -gatherpackages $progsfile installationloop # Install the dotfiles in the user's home directory