base-files: sysupgrade: allow overriding config restore
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Wed, 31 Jan 2024 10:43:55 +0000 (11:43 +0100)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Mon, 4 Mar 2024 15:27:39 +0000 (16:27 +0100)
Some platforms like Raspberry Pi require patching some backup files like
cmdline.txt in order to set the correct root PARTUUID.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
package/base-files/files/sbin/sysupgrade

index 720f3da3fa45476107e461151e925a2576fe0867..ed8871b8922f2d177f34073aaf3b1ad58a30d615 100755 (executable)
@@ -307,7 +307,11 @@ if [ -n "$CONF_RESTORE" ]; then
 
        [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V=""
        v "Restoring config files..."
-       tar -C / -x${TAR_V}zf "$CONF_RESTORE"
+       if [ "$(type -t platform_restore_backup)" == 'platform_restore_backup' ]; then
+               platform_restore_backup "$TAR_V"
+       else
+               tar -C / -x${TAR_V}zf "$CONF_RESTORE"
+       fi
        exit $?
 fi