Files
openwrt-master/target/linux/octeon/base-files/lib/preinit/79_move_config
domenico c06fb25d1f
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Initial commit
2025-06-24 14:35:53 +02:00

51 lines
1.1 KiB
Plaintext

# Copyright (C) 2014 OpenWrt.org
move_config() {
. /lib/upgrade/common.sh
local device="$1"
local fstype="$2"
[ -n "$device" ] && [ -b "$device" ] && {
mount -t "${fstype}" "$device" /mnt
[ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
umount /mnt
}
}
octeon_get_n821_disk() {
local partnum=$1
local MAJOR MINOR DEVNAME DEVTYPE
while read line; do
export -n "${line}"
done < $(find /sys/bus/platform/devices/16f0000000000.ehci/ -path \*block/sd[a-z]/uevent)
echo "/dev/${DEVNAME}${partnum}"
}
octeon_move_config() {
. /lib/functions.sh
case "$(board_name)" in
erlite|\
ubnt,usg)
move_config "/dev/sda1" "vfat"
;;
itus,shield-router)
move_config "/dev/mmcblk1p1" "vfat"
;;
er|\
ubnt,edgerouter-4|\
ubnt,edgerouter-6p)
move_config "/dev/mmcblk0p1" "vfat"
;;
cisco,vedge1000)
# Copy from the internal USB disk's first partition.
# It is resolved from the device path to not be dependent on which
# /dev/sd? path it is at, nor which UUID it happens to have.
move_config "$(octeon_get_n821_disk 1)" "ext2"
;;
esac
}
boot_hook_add preinit_mount_root octeon_move_config