✨ (install.sh): add check for sudo installation and install if missing to ensure script can run with necessary privileges
This commit is contained in:
21
install.sh
21
install.sh
@@ -27,6 +27,27 @@ else
|
|||||||
echo ".gitconfig does not exist, no backup created."
|
echo ".gitconfig does not exist, no backup created."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check if sudo is installed, if not, install it
|
||||||
|
if ! command -v sudo &> /dev/null; then
|
||||||
|
echo "sudo is not installed. Installing sudo..."
|
||||||
|
if command -v apt &> /dev/null; then
|
||||||
|
apt update && apt install -y sudo
|
||||||
|
elif command -v pacman &> /dev/null; then
|
||||||
|
pacman -S sudo
|
||||||
|
elif command -v dnf &> /dev/null; then
|
||||||
|
dnf install -y sudo
|
||||||
|
elif command -v yum &> /dev/null; then
|
||||||
|
yum install -y sudo
|
||||||
|
elif command -v brew &> /dev/null; then
|
||||||
|
brew install sudo
|
||||||
|
elif command -v pkg &> /dev/null; then
|
||||||
|
pkg install sudo
|
||||||
|
else
|
||||||
|
echo "Package manager not found. Please install sudo manually."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null; then
|
if command -v zsh &> /dev/null && command -v git &> /dev/null && command -v wget &> /dev/null && command -v fc-cache &> /dev/null; then
|
||||||
echo -e "ZSH, Git, wget, and fontconfig are already installed\n"
|
echo -e "ZSH, Git, wget, and fontconfig are already installed\n"
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user