Fix sudo stuff

This commit is contained in:
askiiart 2023-09-06 15:18:40 -05:00
parent fba184d4f8
commit 6cd0b98342
2 changed files with 17 additions and 19 deletions

View file

@ -9,9 +9,7 @@ EMAIL="dev@askiiart.net"
# Note: This waits until enter is pressed # Note: This waits until enter is pressed
# read -p "Press Enter to continue" < /dev/tty # read -p "Press Enter to continue" < /dev/tty
if [ $(whoami) != "root" ]; then if [ $(whoami) == "root" ]; then
SUDO="sudo"
else
echo "Run as a normal user, not root" echo "Run as a normal user, not root"
exit 1 exit 1
fi fi
@ -19,19 +17,19 @@ fi
command_exists() { type "$1" &>/dev/null; } command_exists() { type "$1" &>/dev/null; }
if command_exists "apt-get"; then 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 elif command_exists "yum"; then
$SUDO yum install pass git -y sudo yum install pass git -y
elif command_exists "pacman"; then elif command_exists "pacman"; then
$SUDO pacman -S git --noconfirm sudo pacman -S git --noconfirm
$SUDO pacman -S pass --noconfirm sudo pacman -S pass --noconfirm
elif command_exists "zypp"; then elif command_exists "zypp"; then
$SUDO zypper install pass git -y sudo zypper install pass git -y
elif command_exists "emerge"; then elif command_exists "emerge"; then
$SUDO echo Not yet supported, exiting... sudo echo Not yet supported, exiting...
elif command_exists "apk"; then elif command_exists "apk"; then
$SUDO apk add pass sudo apk add pass
$SUDO apk add git sudo apk add git
else else
echo "Unsupported: unknown package manager" echo "Unsupported: unknown package manager"
fi fi

View file

@ -12,19 +12,19 @@ fi
command_exists() { type "$1" &>/dev/null; } command_exists() { type "$1" &>/dev/null; }
if command_exists "apt-get"; then if command_exists "apt-get"; then
$SUDO apt-get install zsh -y sudo apt-get install zsh -y
elif command_exists "yum"; then elif command_exists "yum"; then
$SUDO apt-get install zsh -y sudo apt-get install zsh -y
elif command_exists "pacman"; then elif command_exists "pacman"; then
$SUDO pacman -S zsh --noconfirm --needed sudo pacman -S zsh --noconfirm --needed
elif command_exists "zypper"; then elif command_exists "zypper"; then
$SUDO zypper install zsh -y sudo zypper install zsh -y
elif command_exists "emerge"; then elif command_exists "emerge"; then
$SUDO emerge --ask app-shells/zsh sudo emerge app-shells/zsh
$SUDO emerge --ask app-shells/zsh-completions sudo emerge app-shells/zsh-completions
$SUDO emerge --ask app-shells/gentoo-zsh-completions sudo emerge app-shells/gentoo-zsh-completions
elif command_exists "apk"; then elif command_exists "apk"; then
$SUDO apk add zsh -y sudo apk add zsh -y
else else
echo >&2 "Unsupported: unknown package manager" echo >&2 "Unsupported: unknown package manager"
exit 1 exit 1