From 83c159f6fadae900c9e7106e61ba5284de88b6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mah=C3=A9?= Date: Sat, 5 Oct 2019 18:37:28 +0200 Subject: [PATCH] adding a test for the REBOOT_PAUSE value (>= 0) and some code style modification. Sorry about that, I think I have an OCD... --- mister_updater.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mister_updater.sh b/mister_updater.sh index 062709c..44f5c5b 100755 --- a/mister_updater.sh +++ b/mister_updater.sh @@ -153,7 +153,7 @@ UNRAR_DEBS_URL="http://http.us.debian.org/debian/pool/non-free/u/unrar-nonfree" #Uncomment this if you want the script to sync the system date and time with a NTP server #NTP_SERVER="0.pool.ntp.org" AUTOREBOOT="true" -REBOOT_PAUSE=0 +REBOOT_PAUSE=0 # in seconds TEMP_PATH="/tmp" TO_BE_DELETED_EXTENSION="to_be_deleted" @@ -744,16 +744,14 @@ then fi echo "Done!" -if [ $REBOOT_NEEDED == "true" ] -then - if [ $AUTOREBOOT == "true" ] - then - echo "Rebooting in $REBOOT_PAUSE seconds" - sleep $REBOOT_PAUSE - reboot now - else - echo "You should reboot" - fi +if [[ "${REBOOT_NEEDED}" == "true" ]] ; then + if [[ "${AUTOREBOOT}" == "true" && "${REBOOT_PAUSE}" -ge 0 ]] ; then + echo "Rebooting in ${REBOOT_PAUSE} seconds" + sleep "${REBOOT_PAUSE}" + reboot now + else + echo "You should reboot" + fi fi exit 0