From c2086d3ec7f812698066d152973aa195f2e99a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Sat, 9 Dec 2017 18:39:40 +0100 Subject: [PATCH] installer.sh.in: check for empty USERLOGIN Append a line to sudoers only, if the USERLOGIN is actually non-empty. Otherwise only enable sudo for the members of group 'wheel'. Closes #138 Closes: #143 [via git-merge-pr] --- installer.sh.in | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/installer.sh.in b/installer.sh.in index 1399155..84ef265 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -1284,15 +1284,17 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return fi if [ -f $TARGETDIR/etc/sudoers ]; then - if [ -z "$(echo $(get_option USERGROUPS) | grep -w wheel)" ]; then - # enable sudo for primary user USERLOGIN - echo "# Enable sudo for login '$(get_option USERLOGIN)'" >> $TARGETDIR/etc/sudoers - echo "$(get_option USERLOGIN) ALL=(ALL) ALL" >> $TARGETDIR/etc/sudoers + USERLOGIN="$(get_option USERLOGIN)" + if [ -z "$(echo $(get_option USERGROUPS) | grep -w wheel)" -a -n "$USERLOGIN" ]; then + # enable sudo for primary user USERLOGIN who is not member of wheel + echo "# Enable sudo for login '$USERLOGIN'" >> $TARGETDIR/etc/sudoers + echo "$USERLOGIN ALL=(ALL) ALL" >> $TARGETDIR/etc/sudoers else - # enable sudoers entry for members of group wheel for primary user + # enable the sudoers entry for members of group wheel sed -i $TARGETDIR/etc/sudoers \ -e "s;#.*%wheel ALL=(ALL) ALL;%wheel ALL=(ALL) ALL;" fi + unset USERLOGIN fi # enable text console for grub if chosen