lantiq: switch to kernel 6.1
[openwrt/openwrt.git] / target / linux / octeon / base-files / lib / preinit / 79_move_config
index 4ab321b690d667a36897147e78f0aca81e07d6ea..01491500a03ee7563ce3020367fbd1faa81f90f9 100644 (file)
@@ -1,14 +1,32 @@
-#!/bin/sh
 # Copyright (C) 2014 OpenWrt.org
 
 move_config() {
-       case "$(cat /tmp/sysinfo/board_name)" in
-               erlite)
-                       mount -t vfat /dev/sda1 /mnt
-                       [ -f /mnt/sysupgrade.tgz ] && mv -f /mnt/sysupgrade.tgz /
-                       umount /mnt
+       . /lib/upgrade/common.sh
+
+       local device="$1"
+       [ -n "$device" ] && [ -b "$device" ] && {
+               mount -t vfat "$device" /mnt
+               [ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
+               umount /mnt
+       }
+}
+
+octeon_move_config() {
+       . /lib/functions.sh
+
+       case "$(board_name)" in
+               erlite|\
+               ubnt,usg)
+                       move_config "/dev/sda1"
+                       ;;
+               itus,shield-router)
+                       move_config "/dev/mmcblk1p1"
+                       ;;
+               ubnt,edgerouter-4 | \
+               ubnt,edgerouter-6p)
+                       move_config "/dev/mmcblk0p1"
                        ;;
        esac
 }
 
-boot_hook_add preinit_mount_root move_config
+boot_hook_add preinit_mount_root octeon_move_config