base-files: sysupgrade: pass "backup" ubus attribute
authorRafał Miłecki <rafal@milecki.pl>
Fri, 6 Sep 2019 05:10:52 +0000 (07:10 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 16 Sep 2019 03:56:25 +0000 (05:56 +0200)
This explicitly tells procd what backup file should be used during
sysupgrade (if any). It's much more generic this way compared to the
magic /tmp/sysupgrade.tgz file that had to be created before a call.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit c5223b26a40ae61fc7750bf865464048af328ab1)

package/base-files/files/sbin/sysupgrade

index f106c3c981873d1d7628559ee0db173b364e3bc4..f18143bff42ef6659fb3a0281b19c60a72f125d8 100755 (executable)
@@ -362,10 +362,13 @@ if [ -n "$FAILSAFE" ]; then
 else
        force_attr=""
        [ $FORCE -eq 1 ] && force_attr="\"force\": true,"
+       backup_attr=""
+       [ $SAVE_CONFIG -eq 1 ] && backup_attr="\"backup\": $(json_string $CONF_TAR),"
        ubus call system sysupgrade "{
                \"prefix\": $(json_string "$RAM_ROOT"),
                \"path\": $(json_string "$IMAGE"),
                $force_attr
+               $backup_attr
                \"command\": $(json_string "$COMMAND"),
                \"options\": {
                        \"save_config\": $SAVE_CONFIG,