octeon: use dedicated function to move config backup
[openwrt/openwrt.git] / target / linux / octeon / base-files / lib / preinit / 79_move_config
1 # Copyright (C) 2014 OpenWrt.org
2
3 move_config() {
4 . /lib/upgrade/common.sh
5
6 local device="$1"
7 [ -n "$device" ] && [ -b "$device" ] && {
8 mount -t vfat "$device" /mnt
9 [ -f "/mnt/$BACKUP_FILE" ] && mv -f "/mnt/$BACKUP_FILE" /
10 umount /mnt
11 }
12 }
13
14 octeon_move_config() {
15 . /lib/functions.sh
16
17 case "$(board_name)" in
18 erlite)
19 move_config "/dev/sda1"
20 ;;
21 itus,shield-router)
22 move_config "/dev/mmcblk1p1"
23 ;;
24 esac
25 }
26
27 boot_hook_add preinit_mount_root octeon_move_config