arch-automated-installer/scripts/system-setup/sudo-setup.sh
2024-06-27 15:24:32 +08:00

40 lines
1,016 B
Bash
Executable file

#!/bin/bash
read -p "Enter the user to add to Sudo: " username
if [[ $1 == "Debian" ]]; then
echo "$1 Sudo Setup"
while [[ true ]]; do
if [[ ! -z $(grep $username /etc/passwd) ]]; then
echo "usermod -aG sudo $username"
if [[ -f /home/$username/ ]]; then
echo "Home exists"
else
echo "Home doesn't Exist"
fi
break
else
read -p "Invalid Username. Use an valid existing username." username
fi
done
elif [[ $1 == "Arch" ]]; then
echo "$1 Sudo Setup"
while [[ true ]]; do
if [[ ! -z $(grep $username /etc/passwd) ]]; then
echo "usermod -aG wheel $username"
if [[ -f /home/$username/ ]]; then
echo "Home exists"
else
echo "Home doesn't Exist"
fi
break
else
read -p "Invalid Username. Use a valid existing username:" username
fi
done
fi