add sysupgrade support
[openwrt/openwrt.git] / target / linux / mvebu / base-files / lib / preinit / 81_linksys_syscfg
1 #
2 # Copyright (C) 2014 OpenWrt.org
3 #
4
5 preinit_mount_syscfg() {
6
7 . /lib/functions.sh
8 . /lib/mvebu.sh
9
10 case $(mvebu_board_name) in
11 armada-xp-mamba)
12 mkdir /tmp/syscfg
13 ubiattach -p /dev/mtd8
14 mount -t ubifs ubi1:syscfg /tmp/syscfg
15 [ -f /tmp/syscfg/sysupgrade.tgz ] && {
16 echo "- config restore -"
17 cd /
18 mv /tmp/syscfg/sysupgrade.tgz /tmp
19 tar xzf /tmp/sysupgrade.tgz
20 rm -f /tmp/sysupgrade.tgz
21 sync
22 }
23 ;;
24 esac
25 }
26
27 boot_hook_add preinit_main preinit_mount_syscfg