summaryrefslogtreecommitdiff
path: root/zirless.sh
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-01-28 22:29:39 -0600
committerzachir <zachir@librem.one>2022-01-28 22:29:39 -0600
commit14f275be1580fcb3df47a804646a9c99cc79b511 (patch)
tree056c7dfe82df4967e8121cff1218ad2faf603aff /zirless.sh
parentbc02677e03fd73dd991513abd76b8e25552d7662 (diff)
finish the previous commit
Diffstat (limited to 'zirless.sh')
-rw-r--r--zirless.sh19
1 files changed, 10 insertions, 9 deletions
diff --git a/zirless.sh b/zirless.sh
index ec7ebbd..5cb800d 100644
--- a/zirless.sh
+++ b/zirless.sh
@@ -20,6 +20,7 @@ esac done
[ -z "$progsfile" ] && progsfile="progs.csv"
[ -z "$aurhelper" ] && aurhelper="yay"
[ -z "$repobranch" ] && repobranch="master"
+[ -z "$rootcmd" ] && rootcmd="sudo"
### FUNCTIONS ###
@@ -128,9 +129,9 @@ manualinstall() { # Installs $1 manually if not installed. Used only for AUR hel
cd /tmp || exit 1
rm -rf /tmp/"$1"*
curl -sO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz &&
- sudo -u "$name" tar -xvf "$1".tar.gz >/dev/null 2>&1 &&
+ $rootcmd -u "$name" tar -xvf "$1".tar.gz >/dev/null 2>&1 &&
cd "$1" &&
- sudo -u "$name" makepkg --noconfirm -si >/dev/null 2>&1 || return 1
+ $rootcmd -u "$name" makepkg --noconfirm -si >/dev/null 2>&1 || return 1
cd /tmp || return 1) ;}
maininstall() { # Installs all needed programs from main repo.
@@ -142,9 +143,9 @@ gitmakeinstall() {
progname="$(basename "$1" .git)"
dir="$repodir/$progname"
dialog --title "ZIRLESS Installation" --infobox "Installing \`$progname\` ($n of $total) via \`git\` and \`make\`. $(basename "$1") $2" 5 70
- sudo -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return 1 ; $rootcmd -u "$name" git pull --force origin master;}
+ $rootcmd -u "$name" git clone --depth 1 "$1" "$dir" >/dev/null 2>&1 || { cd "$dir" || return 1 ; $rootcmd -u "$name" git pull --force origin master;}
cd "$dir" || exit 1
- sudo -u "$name" make >/dev/null 2>&1
+ $rootcmd -u "$name" make >/dev/null 2>&1
make install >/dev/null 2>&1
cd /tmp || return 1 ;}
@@ -161,7 +162,7 @@ gitmakepkginstall() {
aurinstall() { \
dialog --title "ZIRLESS Installation" --infobox "Installing \`$1\` ($n of $total) from the AUR. $1 $2" 5 70
echo "$aurinstalled" | grep -q "^$1$" && return 1
- sudo -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
+ $rootcmd -u "$name" $aurhelper -S --noconfirm "$1" >/dev/null 2>&1
}
pipinstall() { \
@@ -192,8 +193,8 @@ putgitrepo() { # Downloads a gitrepo $1 and places the files in $2 only overwrit
dir=$(mktemp -d)
[ ! -d "$2" ] && mkdir -p "$2"
chown "$name":wheel "$dir" "$2"
- sudo -u "$name" git clone --recursive -b "$branch" --depth 1 --recurse-submodules "$1" "$dir" >/dev/null 2>&1
- sudo -u "$name" cp -rfT "$dir" "$2"
+ $rootcmd -u "$name" git clone --recursive -b "$branch" --depth 1 --recurse-submodules "$1" "$dir" >/dev/null 2>&1
+ $rootcmd -u "$name" cp -rfT "$dir" "$2"
}
systembeepoff() { dialog --infobox "Getting rid of that retarded error beep sound..." 10 50
@@ -239,7 +240,7 @@ ntpdate 0.us.pool.ntp.org >/dev/null 2>&1
adduserandpass || error "Error adding username and/or password."
-[ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers # Just in case
+[ "$rootcmd" = "sudo" ] && [ -f /etc/sudoers.pacnew ] && cp /etc/sudoers.pacnew /etc/sudoers # Just in case
# Allow user to run $rootcmd without password. Since AUR programs must be installed
# in a fakeroot environment, this is required for all builds with AUR.
@@ -281,7 +282,7 @@ systembeepoff
# Make zsh the default shell for the user.
chsh -s /bin/zsh "$name" >/dev/null 2>&1
-sudo -u "$name" mkdir -p "/home/$name/.cache/zsh/"
+$rootcmd -u "$name" mkdir -p "/home/$name/.cache/zsh/"
# dbus UUID must be generated for Artix runit.
dbus-uuidgen > /var/lib/dbus/machine-id