treewide: sysupgrade: pass "save_partitions" option to the "sysupgrade" method
authorRafał Miłecki <rafal@milecki.pl>
Fri, 16 Aug 2019 15:02:58 +0000 (17:02 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Thu, 22 Aug 2019 11:47:51 +0000 (13:47 +0200)
This explicitly lets stage2 know if partitions should be preserved. No
more "touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap" hack.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
package/base-files/files/lib/upgrade/stage2
package/base-files/files/sbin/sysupgrade
target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh
target/linux/brcm2708/base-files/lib/upgrade/platform.sh
target/linux/mvebu/base-files/lib/upgrade/sdcard.sh
target/linux/omap/base-files/lib/upgrade/platform.sh
target/linux/sunxi/base-files/lib/upgrade/platform.sh
target/linux/tegra/base-files/lib/upgrade/platform.sh
target/linux/x86/base-files/lib/upgrade/platform.sh

index 4e5837af833dd7217ca8d9946584a02751eb0138..ff2a9aee057255cd06ac25eceb2001500618757b 100755 (executable)
@@ -6,8 +6,6 @@
 export IMAGE="$1"
 COMMAND="$2"
 
-export SAVE_PARTITIONS=1
-
 export INTERACTIVE=0
 export VERBOSE=1
 export CONFFILES=/tmp/sysupgrade.conffiles
@@ -16,9 +14,6 @@ export CONF_TAR=/tmp/sysupgrade.tgz
 RAMFS_COPY_BIN=                # extra programs for temporary ramfs root
 RAMFS_COPY_DATA=       # extra data files
 
-
-[ -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap ] && export SAVE_PARTITIONS=0
-
 include /lib/upgrade
 
 
index 15514159b35fd22f4feb2fdec4e69d48815d8d28..c27c1fbc47766619b19a1ac813e040b3cdffa56a 100755 (executable)
@@ -351,12 +351,6 @@ if [ $TEST -eq 1 ]; then
        exit 0
 fi
 
-if [ $SAVE_PARTITIONS -eq 0 ]; then
-       touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap
-else
-       rm -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap
-fi
-
 install_bin /sbin/upgraded
 v "Commencing upgrade. Closing all shell sessions."
 
@@ -371,7 +365,8 @@ else
                \"path\": $(json_string "$IMAGE"),
                \"command\": $(json_string "$COMMAND"),
                \"options\": {
-                       \"save_config\": $SAVE_CONFIG
+                       \"save_config\": $SAVE_CONFIG,
+                       \"save_partitions\": $SAVE_PARTITIONS
                }
        }"
 fi
index c1912711497d6df31bc1b05b016ec895bc12c335..01327d926a52586c0c8a21131be6877aae84cafa 100644 (file)
@@ -43,7 +43,7 @@ mbl_do_upgrade() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image
index 37e479272bf8e10bb139ff2de87e96c015b22896..693cde777950d70f8c8f9588061db7e15b93b0d6 100644 (file)
@@ -45,7 +45,7 @@ platform_do_upgrade() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image
index 5ca5e71fe7ff9cb923df87339f60ec29362adee9..3bfdce97e8d9bc531dcdee02852e48995dafcd53 100644 (file)
@@ -49,7 +49,7 @@ platform_do_upgrade_sdcard() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image
index abe910b154c7de928687abde7707ee58da8d59d5..c8b0175fd58c56fadac29db3462e0e04df37274c 100644 (file)
@@ -45,7 +45,7 @@ platform_do_upgrade() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image
index abe910b154c7de928687abde7707ee58da8d59d5..c8b0175fd58c56fadac29db3462e0e04df37274c 100644 (file)
@@ -45,7 +45,7 @@ platform_do_upgrade() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image
index 97dd381041b1f51211e79b3453cf56462a53ccc2..66e7d91e3cb13508043c8a493f6a51ea3bc85e1f 100644 (file)
@@ -62,7 +62,7 @@ platform_do_upgrade() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image
index 439ba8f5125d97932248ff966340165a84e1b24a..162dbaf3aaaa00539851856b67e8e6b1a5eb8b08 100644 (file)
@@ -54,7 +54,7 @@ platform_do_upgrade() {
 
        sync
 
-       if [ "$SAVE_PARTITIONS" = "1" ]; then
+       if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
                get_partitions "/dev/$diskdev" bootdisk
 
                #extract the boot sector from the image