legacy option, branch option readded
This commit is contained in:
parent
183d757073
commit
308f6c5a39
22
larbs.sh
22
larbs.sh
@ -8,24 +8,30 @@
|
||||
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 -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 ;;
|
||||
esac done
|
||||
|
||||
# DEFAULTS:
|
||||
[ -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 ###
|
||||
|
||||
error() { clear; printf "ERROR:\\n%s\\n" "$1"; exit;}
|
||||
|
||||
welcomemsg() { \
|
||||
dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured i3wm Arch Linux desktop, which I use as my main machine.\\n\\n-Luke" 10 60
|
||||
dialog --title "Welcome!" --msgbox "Welcome to Luke's Auto-Rice Bootstrapping Script!\\n\\nThis script will automatically install a fully-featured Linux desktop, which I use as my main machine.\\n\\n-Luke" 10 60
|
||||
}
|
||||
|
||||
selectdotfiles() { \
|
||||
edition="$(dialog --title "Select LARBS version." --menu "Select which version of LARBS you wish to install." 10 70 2 dwm "The current version of LARBS using suckless's dwm." i3 "The legacy version of LARBS using i3." custom "If you are supplying commandline options for LARBS." 3>&1 1>&2 2>&3 3>&1)"
|
||||
case "$edition" in
|
||||
dwm) dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git" ; repobranch="master" ; progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/progs.csv" ;;
|
||||
i3) dotfilesrepo="https://github.com/lukesmithxyz/voidrice.git" ; repobranch="archi3" ; progsfile="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/legacy.csv" ;;
|
||||
esac ;}
|
||||
|
||||
getuserandpass() { \
|
||||
# Prompts user for new username an password.
|
||||
name=$(dialog --inputbox "First, please enter a name for the user account." 10 60 3>&1 1>&2 2>&3 3>&1) || exit
|
||||
@ -120,10 +126,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 "$3" ] && 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"
|
||||
}
|
||||
|
||||
@ -155,8 +162,9 @@ finalize(){ \
|
||||
# Check if user is root on Arch distro. Install dialog.
|
||||
pacman -Syu --noconfirm --needed dialog || error "Are you sure you're running this as the root user? Are you sure you're using an Arch-based distro? ;-) Are you sure you have an internet connection? Are you sure your Arch keyring is updated?"
|
||||
|
||||
# Welcome user.
|
||||
# Welcome user and pick dotfiles.
|
||||
welcomemsg || error "User exited."
|
||||
selectdotfiles || error "User exited."
|
||||
|
||||
# Get and verify username and password.
|
||||
getuserandpass || error "User exited."
|
||||
@ -198,7 +206,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/
|
||||
|
1
legacy.csv
Normal file
1
legacy.csv
Normal file
@ -0,0 +1 @@
|
||||
<html><body>You are being <a href="https://raw.githubusercontent.com/LukeSmithxyz/LARBS/master/archi3/progs.csv">redirected</a>.</body></html>
|
Can't render this file because it contains an unexpected character in line 1 and column 35.
|
Loading…
Reference in New Issue
Block a user