octeon: use dedicated function to move config backup
All octeon devices use the same or a very similar way to backup and restore configuration. We expect to have more devices added and in order to stop repeating ourselves move the logic to a separate function. While at it, add a few checks. Signed-off-by: Roman Kuzmitskii <damex.pp@icloud.com> [commit message facelift] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
d7db32440f
commit
733700c652
1 changed files with 14 additions and 8 deletions
|
@ -1,21 +1,27 @@
|
||||||
# Copyright (C) 2014 OpenWrt.org
|
# Copyright (C) 2014 OpenWrt.org
|
||||||
|
|
||||||
move_config() {
|
move_config() {
|
||||||
. /lib/functions.sh
|
|
||||||
. /lib/upgrade/common.sh
|
. /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
|
case "$(board_name)" in
|
||||||
erlite)
|
erlite)
|
||||||
mount -t vfat /dev/sda1 /mnt
|
move_config "/dev/sda1"
|
||||||
[ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
|
|
||||||
umount /mnt
|
|
||||||
;;
|
;;
|
||||||
itus,shield-router)
|
itus,shield-router)
|
||||||
mount -t vfat /dev/mmcblk1p1 /mnt
|
move_config "/dev/mmcblk1p1"
|
||||||
[ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
|
|
||||||
umount /mnt
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_hook_add preinit_mount_root move_config
|
boot_hook_add preinit_mount_root octeon_move_config
|
||||||
|
|
Loading…
Reference in a new issue