diff --git a/linupx-scripts.sh b/linupx-scripts.sh index c32b1a4..fe2fcbc 100755 --- a/linupx-scripts.sh +++ b/linupx-scripts.sh @@ -92,12 +92,22 @@ UPDATE2() { read -n 1 -s -p "Press any key to continue" } UPDATE3() { + restart_flag=''; export DEBIAN_FRONTEND="noninteractive" source /etc/environment bash /etc/skel/.profile - mv -f /opt/runupdates.log.2 /opt/runupdates.log.3 - mv -f /opt/runupdates.log.1 /opt/runupdates.log.2 - mv -f /opt/runupdates.log /opt/runupdates.log.1 + + while getopts 'abf:v' flag; do + case "${flag}" in + r) restart_flag='true' ;; + esac + done + + if [ "$autorun_logging" = true ]; then + mv -f /opt/runupdates.log.2 /opt/runupdates.log.3 + mv -f /opt/runupdates.log.1 /opt/runupdates.log.2 + mv -f /opt/runupdates.log /opt/runupdates.log.1 + fi if type yum &>/dev/null; then yum -y update >> /opt/runupdates.log else @@ -117,9 +127,11 @@ UPDATE3() { touch "${FOLDER}/lastrun" echo "" echo -e "${Green}Updates have completed${Color_Off}" - echo -e "${BOrange}Rebooting now...${Color_Off}" - sleep 3 - /sbin/shutdown -r now + if [ "$autorun_restart_after" = true ] || [ "$restart_flag" = true ]; then + echo -e "${BOrange}Rebooting now...${Color_Off}" + sleep 3 + /sbin/shutdown -r now + fi exit 0 } DISTUPGRADE() {