Fix sudo stuff and cp

This commit is contained in:
askiiart 2023-08-30 22:15:13 -05:00
parent c76d0fcd11
commit 131b2e5ec1
No known key found for this signature in database
GPG key ID: 85505F3A2264FA01
2 changed files with 19 additions and 10 deletions

View file

@ -9,22 +9,29 @@ 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
$SUDO = "sudo"
else
echo "Run as a normal user, not root"
exit 1
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
apt-get install pass git -y $SUDO apt-get install pass git -y
elif command_exists "yum"; then elif command_exists "yum"; then
yum install pass git -y $SUDO yum install pass git -y
elif command_exists "pacman"; then elif command_exists "pacman"; then
pacman -S git --noconfirm $SUDO pacman -S git --noconfirm
pacman -S pass --noconfirm $SUDO pacman -S pass --noconfirm
elif command_exists "zypp"; then elif command_exists "zypp"; then
zypper install pass git -y $SUDO zypper install pass git -y
elif command_exists "emerge"; then elif command_exists "emerge"; then
echo Not yet supported, exiting... $SUDO echo Not yet supported, exiting...
elif command_exists "apk"; then elif command_exists "apk"; then
apk add pass $SUDO apk add pass
apk add git $SUDO apk add git
else else
echo "Unsupported: unknown package manager" echo "Unsupported: unknown package manager"
fi fi

View file

@ -4,9 +4,11 @@ set -e
if [ $(whoami) != "root" ]; then if [ $(whoami) != "root" ]; then
$SUDO = "sudo" $SUDO = "sudo"
else
echo "Run as a normal user, not root"
exit 1 exit 1
fi fi
exit 0
command_exists() { type "$1" &>/dev/null; } command_exists() { type "$1" &>/dev/null; }
if command_exists "apt-get"; then if command_exists "apt-get"; then
@ -28,4 +30,4 @@ else
exit 1 exit 1
fi fi
cp -r zsh-files/* ~/ cp -r zsh-files/.* ~/