summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2020-06-16 21:50:13 +0100
committerDavid T. Sadler <davidtsadler@googlemail.com>2020-06-16 21:50:13 +0100
commit0c2774d2a5da6f8cfe4aa26f0dfa68f31423dabc (patch)
treeb1b63a771f293d590b4354c4e2346332c19003fb
parent68b23aae3c33952985cd5eaa6adf9bce87a39b26 (diff)
Grante sudo access to user that is created
-rw-r--r--gohan.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/gohan.sh b/gohan.sh
index cb35b83..789d954 100644
--- a/gohan.sh
+++ b/gohan.sh
@@ -59,6 +59,7 @@ add_user() {
# Adds user `$name` with password $pass1.
dialog --infobox "Adding user \"$name\"..." 4 50
useradd -m -s /bin/bash "$name" >/dev/null 2>&1 || mkdir -p /home/"$name" && chown "$name":"$name" /home/"$name"
+ usermod -aG wheel "$name"
[ ! -d "/home/$name/.local/src" ] && mkdir -p "/home/$name/.local/src" && chown -R "$name":"$name" /home/"$name/.local"
# Remove these files as they will be installed as part of the dotfiles.
[ -f "/home/$name/.bash_logout" ] && rm /home/$name/.bash_logout
@@ -104,6 +105,10 @@ install_from_github() {
sudo -u "$name" make clean install >/dev/null 2>&1
}
+configure_sudo() {
+ [ -f /etc/sudoers ] && sed -i "s/# %wheel ALL=(ALL) NOPASSWORD: ALL/%wheel ALL=(ALL) NOPASSWORD: ALL/" /etc/sudoers
+}
+
### THE ACTUAL SCRIPT ###
install_from_pacman dialog || error "Are you sure you're running this as the root user and have an internet connection?"
@@ -122,4 +127,6 @@ install_dotfiles $dotfilesrepo "/home/$name/.local/src/dotfiles"
install_software
+configure_sudo()
+
clear