summaryrefslogtreecommitdiffstats
path: root/target/linux/octeon/base-files/lib/preinit/79_move_config
blob: ae155a3c5cbaabf52bb28c418461878ff011a0be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (C) 2014 OpenWrt.org

move_config() {
	. /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)
			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 octeon_move_config