scripts: add update support to sudo_fix.sh

Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
KwadFan 2020-12-05 01:44:32 +01:00 committed by Arksine
parent abbd02aa73
commit d19e9e2d28
1 changed files with 10 additions and 2 deletions

View File

@ -46,6 +46,8 @@ create_sudoers_file()
###
### /sbin/systemctl "reboot", /sbin/apt "update", .....
Defaults!/usr/bin/apt-get env_keep +="DEBIAN_FRONTEND"
Cmnd_Alias REBOOT = /sbin/shutdown -r now, /bin/systemctl "reboot"
Cmnd_Alias SHUTDOWN = /sbin/shutdown now, /sbin/shutdown -h now, /bin/systemctl "poweroff"
Cmnd_Alias APT = /usr/bin/apt-get
@ -60,6 +62,12 @@ Cmnd_Alias SYSTEMCTL = /bin/systemctl
report_status "\e[1;32m...done\e[0m"
}
update_env()
{
report_status "Export System Variable: DEBIAN_FRONTEND=noninteractive"
sudo /bin/sh -c 'echo "DEBIAN_FRONTEND=noninteractive" >> /etc/environment'
}
verify_syntax()
{
report_status "\e[1;33mVerifying Syntax of ${SUDOERS_FILE}\e[0m\n"
@ -118,8 +126,7 @@ add_user_to_group()
adduser_hint()
{
report_status "\e[1;31mYou have to logout to take changes effect!\e[0m"
report_status "If you are lazy, issue a reboot :)"
report_status "\e[1;31mYou have to REBOOT to take changes effect!\e[0m"
}
# Helper functions
@ -172,5 +179,6 @@ if [ -e "$SUDOERS_DIR/$SUDOERS_FILE" ] && [ $(sudo cat /etc/gshadow | grep -c "$
fi
fi
update_env
clean_temp
exit 0