FIX: sudo_fix.sh not working on armbian

According to https://github.com/Arksine/moonraker/issues/241

Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
Stephan Wendel 2021-12-04 15:44:09 +01:00 committed by Eric Callahan
parent 6852982406
commit f22e16d8cc
1 changed files with 18 additions and 13 deletions

View File

@ -70,17 +70,22 @@ update_env()
verify_syntax() verify_syntax()
{ {
if [ -n "$(whereis -b visudo | awk '{print $2}')" ]; then
report_status "\e[1;33mVerifying Syntax of ${SUDOERS_FILE}\e[0m\n" report_status "\e[1;33mVerifying Syntax of ${SUDOERS_FILE}\e[0m\n"
if [ $(LANG=C visudo -cf $SCRIPT_TEMP_PATH/$SUDOERS_FILE | grep -c "OK" ) -eq 1 ]; if [ $(LANG=C sudo visudo -cf $SCRIPT_TEMP_PATH/$SUDOERS_FILE | grep -c "OK" ) -eq 1 ];
then then
VERIFY_STATUS=0 VERIFY_STATUS=0
report_status "\e[1;32m$(LANG=C visudo -cf $SCRIPT_TEMP_PATH/$SUDOERS_FILE)\e[0m" report_status "\e[1;32m$(LANG=C sudo visudo -cf $SCRIPT_TEMP_PATH/$SUDOERS_FILE)\e[0m"
else else
report_status "\e[1;31mSyntax Error:\e[0m Check File: $SCRIPT_TEMP_PATH/$SUDOERS_FILE" report_status "\e[1;31mSyntax Error:\e[0m Check File: $SCRIPT_TEMP_PATH/$SUDOERS_FILE"
exit 1 exit 1
fi fi
else
VERIFY_STATUS=0
report_status "\e[1;31mCommand 'visudo' not found. Skip verifying sudoers file.\e[0m"
fi
} }
install_sudoers_file() install_sudoers_file()