treewide: sysupgrade: pass "save_partitions" option to the "sysupgrade" method
[openwrt/staging/stintel.git] / package / base-files / files / lib / upgrade / stage2
index 3985d8fd7eca9de22b5480f019c137891fc77a32..ff2a9aee057255cd06ac25eceb2001500618757b 100755 (executable)
@@ -6,12 +6,6 @@
 export IMAGE="$1"
 COMMAND="$2"
 
-export ARGV="$IMAGE"
-export ARGC=1
-
-export SAVE_CONFIG=1
-export SAVE_PARTITIONS=1
-
 export INTERACTIVE=0
 export VERBOSE=1
 export CONFFILES=/tmp/sysupgrade.conffiles
@@ -20,10 +14,6 @@ export CONF_TAR=/tmp/sysupgrade.tgz
 RAMFS_COPY_BIN=                # extra programs for temporary ramfs root
 RAMFS_COPY_DATA=       # extra data files
 
-
-[ -f "$CONF_TAR" ] || export SAVE_CONFIG=0
-[ -f /tmp/sysupgrade.always.overwrite.bootdisk.partmap ] && export SAVE_PARTITIONS=0
-
 include /lib/upgrade
 
 
@@ -59,7 +49,7 @@ switch_to_ramfs() {
                local file="$(which "$binary" 2>/dev/null)"
                [ -n "$file" ] && install_bin "$file"
        done
-       install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh $RAMFS_COPY_DATA
+       install_file /etc/resolv.conf /lib/*.sh /lib/functions/*.sh /lib/upgrade/*.sh /lib/upgrade/do_stage2 $RAMFS_COPY_DATA
 
        [ -L "/lib64" ] && ln -s /lib $RAM_ROOT/lib64
 
@@ -122,6 +112,7 @@ kill_remaining() { # [ <signal> [ <loop> ] ]
        echo
 }
 
+indicate_upgrade
 
 killall -9 telnetd
 killall -9 dropbear
@@ -135,10 +126,7 @@ sleep 1
 
 
 if [ -n "$IMAGE" ] && type 'platform_pre_upgrade' >/dev/null 2>/dev/null; then
-       IS_PRE_UPGRADE=1 platform_pre_upgrade "$IMAGE"
-
-       # Needs to be unset again because of busybox weirdness ...
-       IS_PRE_UPGRADE=
+       platform_pre_upgrade "$IMAGE"
 fi
 
 if [ -n "$(rootfs_type)" ]; then