From 131b2e5ec13d53e64184c5468c409ef6a6c58ba9 Mon Sep 17 00:00:00 2001 From: askiiart Date: Wed, 30 Aug 2023 22:15:13 -0500 Subject: [PATCH] Fix sudo stuff and cp --- daily-use-pcs/fedora/setup-git.bash | 23 +++++++++++++++-------- zsh/zsh-setup.bash | 6 ++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/daily-use-pcs/fedora/setup-git.bash b/daily-use-pcs/fedora/setup-git.bash index c723b6a..4b97b60 100755 --- a/daily-use-pcs/fedora/setup-git.bash +++ b/daily-use-pcs/fedora/setup-git.bash @@ -9,22 +9,29 @@ 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 + echo "Run as a normal user, not root" + exit 1 +fi + command_exists() { type "$1" &>/dev/null; } if command_exists "apt-get"; then - apt-get install pass git -y + $SUDO apt-get install pass git -y elif command_exists "yum"; then - yum install pass git -y + $SUDO yum install pass git -y elif command_exists "pacman"; then - pacman -S git --noconfirm - pacman -S pass --noconfirm + $SUDO pacman -S git --noconfirm + $SUDO pacman -S pass --noconfirm elif command_exists "zypp"; then - zypper install pass git -y + $SUDO zypper install pass git -y elif command_exists "emerge"; then - echo Not yet supported, exiting... + $SUDO echo Not yet supported, exiting... elif command_exists "apk"; then - apk add pass - 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 183ee83..d451f6c 100755 --- a/zsh/zsh-setup.bash +++ b/zsh/zsh-setup.bash @@ -4,9 +4,11 @@ set -e if [ $(whoami) != "root" ]; then $SUDO = "sudo" +else + echo "Run as a normal user, not root" exit 1 fi -exit 0 + command_exists() { type "$1" &>/dev/null; } if command_exists "apt-get"; then @@ -28,4 +30,4 @@ else exit 1 fi -cp -r zsh-files/* ~/ +cp -r zsh-files/.* ~/