From 6cd0b983421c02aa30cd817ebfc9f63adb7ad702 Mon Sep 17 00:00:00 2001 From: askiiart Date: Wed, 6 Sep 2023 15:18:40 -0500 Subject: [PATCH] Fix sudo stuff --- daily-use-pcs/setup-git.bash | 20 +++++++++----------- zsh/zsh-setup.bash | 16 ++++++++-------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/daily-use-pcs/setup-git.bash b/daily-use-pcs/setup-git.bash index d4e5804..2d18c0a 100755 --- a/daily-use-pcs/setup-git.bash +++ b/daily-use-pcs/setup-git.bash @@ -9,9 +9,7 @@ EMAIL="dev@askiiart.net" # Note: This waits until enter is pressed # read -p "Press Enter to continue" < /dev/tty -if [ $(whoami) != "root" ]; then - SUDO="sudo" -else +if [ $(whoami) == "root" ]; then echo "Run as a normal user, not root" exit 1 fi @@ -19,19 +17,19 @@ fi command_exists() { type "$1" &>/dev/null; } if command_exists "apt-get"; then - $SUDO apt-get install pass git -y + sudo apt-get install pass git -y elif command_exists "yum"; then - $SUDO yum install pass git -y + sudo yum install pass git -y elif command_exists "pacman"; then - $SUDO pacman -S git --noconfirm - $SUDO pacman -S pass --noconfirm + sudo pacman -S git --noconfirm + sudo pacman -S pass --noconfirm elif command_exists "zypp"; then - $SUDO zypper install pass git -y + sudo zypper install pass git -y elif command_exists "emerge"; then - $SUDO echo Not yet supported, exiting... + sudo echo Not yet supported, exiting... elif command_exists "apk"; then - $SUDO apk add pass - $SUDO apk add git + sudo apk add pass + sudo apk add git else echo "Unsupported: unknown package manager" fi diff --git a/zsh/zsh-setup.bash b/zsh/zsh-setup.bash index 587dc68..f34915d 100755 --- a/zsh/zsh-setup.bash +++ b/zsh/zsh-setup.bash @@ -12,19 +12,19 @@ fi command_exists() { type "$1" &>/dev/null; } if command_exists "apt-get"; then - $SUDO apt-get install zsh -y + sudo apt-get install zsh -y elif command_exists "yum"; then - $SUDO apt-get install zsh -y + sudo apt-get install zsh -y elif command_exists "pacman"; then - $SUDO pacman -S zsh --noconfirm --needed + sudo pacman -S zsh --noconfirm --needed elif command_exists "zypper"; then - $SUDO zypper install zsh -y + sudo zypper install zsh -y elif command_exists "emerge"; then - $SUDO emerge --ask app-shells/zsh - $SUDO emerge --ask app-shells/zsh-completions - $SUDO emerge --ask app-shells/gentoo-zsh-completions + sudo emerge app-shells/zsh + sudo emerge app-shells/zsh-completions + sudo emerge app-shells/gentoo-zsh-completions elif command_exists "apk"; then - $SUDO apk add zsh -y + sudo apk add zsh -y else echo >&2 "Unsupported: unknown package manager" exit 1