Pārlūkot izejas kodu

add unattended flag to upgrade script

Alfonso Gamboa 3 gadi atpakaļ
vecāks
revīzija
c0b10e837e
1 mainītis faili ar 39 papildinājumiem un 33 dzēšanām
  1. 39 33
      SD_ROOT/wz_mini/bin/upgrade-run.sh

+ 39 - 33
SD_ROOT/wz_mini/bin/upgrade-run.sh

@@ -131,39 +131,45 @@ reboot
 
 }
 
-if [[ -e /tmp/dbgflag ]]; then
-	upgrade_mode_start
-else
-
-if [ "$1" == "backup_begin" ]; then
-	backup_begin
+if [[ "$1" == "unattended" ]]; then
+	echo "Unattended upgrade!"
+	rm -rf /opt/Upgrade
+	sync
+	setup
 else
 
-read -r -p "${1:-wz_mini, this will download the latest version from github and upgrade your system.  Are you sure? [y/N]} " response
-    case "$response" in
-        [yY][eE][sS]|[yY])
-        if [[ -d /opt/Upgrade ]]; then
-                echo "WARNING: Old Upgrade directory exists"
-                read -r -p "${1:-Unable to proceed, must DELETE old Upgrade directory, are you sure? [y/N]} " response
-                case "$response" in
-                [yY][eE][sS]|[yY])
-                rm -rf /opt/Upgrade
-                sync
-                setup
-                ;;
-                *)
-                echo "User denied directory removal, exit"
-                ;;
-                esac
-        else
-                setup
-        fi
-
-            ;;
-        *)
-                echo "User declined system update, exit"
-            ;;
-    esac
-fi
-
+	if [[ -e /tmp/dbgflag ]]; then
+		upgrade_mode_start
+	else
+
+		if [ "$1" == "backup_begin" ]; then
+			backup_begin
+		else
+
+		read -r -p "${1:-wz_mini, this will download the latest version from github and upgrade your system.  Are you sure? [y/N]} " response
+			case "$response" in
+			[yY][eE][sS]|[yY])
+			if [[ -d /opt/Upgrade ]]; then
+				echo "WARNING: Old Upgrade directory exists"
+				read -r -p "${1:-Unable to proceed, must DELETE old Upgrade directory, are you sure? [y/N]} " response
+				case "$response" in
+				[yY][eE][sS]|[yY])
+				rm -rf /opt/Upgrade
+				sync
+				setup
+				;;
+				*)
+				echo "User denied directory removal, exit"
+				;;
+	       			esac
+		        else
+				setup
+	        	fi
+			;;
+		        *)
+			echo "User declined system update, exit"
+	        	;;
+		    esac
+		fi
+	fi
 fi