From edda8ff56f9b06cde91f92527bd95697e64b4c30 Mon Sep 17 00:00:00 2001 From: maride Date: Sat, 2 Sep 2017 16:55:17 +0200 Subject: [PATCH] Add user to sudo if requested --- flavours/user.flavour/install.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flavours/user.flavour/install.sh b/flavours/user.flavour/install.sh index 65810ec..d45e66c 100755 --- a/flavours/user.flavour/install.sh +++ b/flavours/user.flavour/install.sh @@ -13,6 +13,16 @@ else read name export username=$name arch-chroot /mnt useradd -m $name - arch-chroot /mnt passwd $name + arch-chroot /mnt passwd $name + + # If group "sudo" exists (=> sudo.flavour was installed), ask if the user should be added + if [ $(getent group sudo) ]; then + echo -n "~> Do you want to add $name to sudoers? (Y/n) " + read answer + if [ "$answer" == "y" ] || [ "$answer" == "Y" ]; then + usermod -a -G sudo $name + fi + fi + amf_return=0 fi