From 6d5389c7d819070bd12bd4846eaa56ecadcb6de8 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 18 May 2019 16:44:25 -0400 Subject: [PATCH] add branch ability --- archi3/larbs.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/archi3/larbs.sh b/archi3/larbs.sh index 7d03d07..5553e2c 100644 --- a/archi3/larbs.sh +++ b/archi3/larbs.sh @@ -5,9 +5,10 @@ ### OPTIONS AND VARIABLES ### -while getopts ":a:r:p:h" o; do case "${o}" in - h) printf "Optional arguments for custom use:\\n -r: Dotfiles repository (local file or url)\\n -p: Dependencies and programs csv (local file or url)\\n -a: AUR helper (must have pacman-like syntax)\\n -h: Show this message\\n" && exit ;; +while getopts ":a:r:b:p:h" o; do case "${o}" in + h) printf "Optional arguments for custom use:\\n -r: Dotfiles repository (local file or url)\\n -b: Dotfiles branch (master is assumed otherwise)\\n -p: Dependencies and programs csv (local file or url)\\n -a: AUR helper (must have pacman-like syntax)\\n -h: Show this message\\n" && exit ;; r) dotfilesrepo=${OPTARG} && git ls-remote "$dotfilesrepo" || exit ;; + b) repobranch=${OPTARG} ;; p) progsfile=${OPTARG} ;; a) aurhelper=${OPTARG} ;; *) printf "Invalid option: -%s\\n" "$OPTARG" && exit ;; @@ -17,6 +18,7 @@ esac done [ -z "$dotfilesrepo" ] && dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git" [ -z "$progsfile" ] && progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/archi3/progs.csv" [ -z "$aurhelper" ] && aurhelper="yay" +[ -z "$repobranch" ] && repobranch="master" ### FUNCTIONS ### @@ -120,10 +122,11 @@ installationloop() { \ putgitrepo() { # Downlods a gitrepo $1 and places the files in $2 only overwriting conflicts dialog --infobox "Downloading and installing config files..." 4 60 + [ -z "$repobranch" ] && branch="master" || branch="$repobranch" dir=$(mktemp -d) [ ! -d "$2" ] && mkdir -p "$2" && chown -R "$name:wheel" "$2" chown -R "$name:wheel" "$dir" - sudo -u "$name" git clone --depth 1 "$1" "$dir/gitrepo" >/dev/null 2>&1 && + sudo -u "$name" git clone -b "$branch" --depth 1 "$1" "$dir/gitrepo" >/dev/null 2>&1 && sudo -u "$name" cp -rfT "$dir/gitrepo" "$2" } @@ -197,7 +200,7 @@ manualinstall $aurhelper || error "Failed to install AUR helper." installationloop # Install the dotfiles in the user's home directory -putgitrepo "$dotfilesrepo" "/home/$name" +putgitrepo "$dotfilesrepo" "/home/$name" "$repobranch" rm -f "/home/$name/README.md" "/home/$name/LICENSE" # Install the LARBS Firefox profile in ~/.mozilla/firefox/