ipq40xx: add support for Linksys EA6350v3
[openwrt/staging/mkresin.git] / target / linux / ipq40xx / base-files / etc / init.d / zlinksys_recovery
1 #!/bin/sh /etc/rc.common
2 #
3 # This script sets auto_recovery to "yes" and resets the boot counter to 0.
4 # As a golden rule, this should be the latest script to run at boot. For a
5 # developer snapshot, it is fine to set auto_recovery here. But for a stable
6 # release, this script must in fact turn off auto_recovery.
7 #
8 # Why? Because the custom sysupgrade script for the device will turn on
9 # auto_recovery to "yes". And it's the job of this script to set the
10 # boot boot_count to 0 and then disable auto_recovery, as that condition
11 # means that the stable release went well.
12 #
13 # I have to repeat: this script should be changed for stable releases.
14
15 START=99
16 boot() {
17 . /lib/functions.sh
18
19 case $(board_name) in
20 linksys,ea6350v3)
21 # make sure auto_recovery in uboot is always on
22 IS_AUTO_RECOVERY="$(fw_printenv -n auto_recovery)"
23 if [ "$IS_AUTO_RECOVERY" != "yes" ] ; then
24 fw_setenv auto_recovery yes
25 echo "Linksys EA6350v3: fw_setenv: auto_recovery has been set to yes"
26 fi
27 # reset the boot counter
28 fw_setenv boot_count 0
29 mtd resetbc s_env
30 echo "Linksys EA6350v3: boot counter has been reset"
31 echo "Linksys EA6350v3: boot_part=$(fw_printenv -n boot_part)"
32 ;;
33 esac
34 }