#!/bin/sh /etc/rc.common START=99 boot() { case $(board_name) in alfa-network,quad-e4g) [ -n "$(fw_printenv bootcount bootchanged 2>/dev/null)" ] &&\ echo -e "bootcount\nbootchanged\n" | /usr/sbin/fw_setenv -s - ;; beeline,smartbox-turbo|\ rostelecom,rt-sf-1) [[ $(hexdump -n 1 -e '/1 "%1d"' -s $((0x20001)) /dev/mtd3) == \ $((0xff)) ]] || printf '\xff' | dd of=/dev/mtdblock3 \ count=1 bs=1 seek=$((0x20001)) ;; linksys,e5600|\ linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1|\ linksys,ea8100-v2) mtd resetbc s_env || true ;; belkin,rt1800|\ linksys,e7350|\ samknows,whitebox-v8) fw_setenv bootcount 0 ;; zyxel,lte3301-plus) [ $(printf %d $(fw_printenv -n DebugFlag)) -gt 0 ] || fw_setenv DebugFlag 1 [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 [ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0 ;; zyxel,nr7101) [ $(printf %d $(fw_printenv -n DebugFlag)) -gt 0 ] || fw_setenv DebugFlag 0x1 [ $(printf %d $(fw_printenv -n Image1Stable)) -gt 0 ] || fw_setenv Image1Stable 1 [ $(printf %d $(fw_printenv -n Image1Try)) -gt 0 ] && fw_setenv Image1Try 0 ;; esac }