treewide: sync bootcount scripts across targets
authorChuanhong Guo <gch981213@gmail.com>
Sat, 10 Aug 2019 11:35:56 +0000 (19:35 +0800)
committerChuanhong Guo <gch981213@gmail.com>
Sat, 17 Aug 2019 15:52:34 +0000 (23:52 +0800)
This commit made the following changes to sync all bootcount scripts:

1. use boot() instead of start()
    This script only needs to be executed once when boot is complete.
    use boot() to make this explicit.

2. drop sourcing of /lib/functions.sh
    This is aready done in /etc/rc.common.

3. ramips: replace board name checking with a case

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
target/linux/ath79/base-files/etc/init.d/bootcount
target/linux/ipq40xx/base-files/etc/init.d/bootcount
target/linux/ipq806x/base-files/etc/init.d/bootcount
target/linux/kirkwood/base-files/etc/init.d/bootcount
target/linux/mvebu/base-files/etc/init.d/bootcount
target/linux/ramips/base-files/etc/init.d/bootcount

index b71fbf9a69aa05615461e583a3f9f082fea50b00..c734fd9d336e0defa397496d86ea72555efb04a4 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/sh /etc/rc.common
+
 START=99
 
 boot() {
index f2d76f125f33f5172c465ad2eb10b83db104654c..b9d625e29680fe32bad30dd2ae524001698b9d5e 100755 (executable)
@@ -2,9 +2,7 @@
 
 START=99
 
-start() {
-       . /lib/functions.sh
-
+boot() {
        case $(board_name) in
        alfa-network,ap120c-ac)
                [ -n "$(fw_printenv bootcount changed 2>/dev/null)" ] &&\
index 6a5a6d52add34e3176b95cf902195b42d58e9adb..d0bf708e66a98fead97a1ffc949d3c4debd4f43c 100755 (executable)
@@ -2,9 +2,7 @@
 
 START=99
 
-start() {
-       . /lib/functions.sh
-
+boot() {
        case $(board_name) in
        linksys,ea8500)
                mtd resetbc s_env || true
index 20fb3a425ca9c21ef89da00ebeff02440c39a70e..478f3d0134156533cf999ddc872a9d19fbd98f03 100755 (executable)
@@ -2,9 +2,7 @@
 
 START=99
 
-start() {
-       . /lib/functions.sh
-
+boot() {
        case $(board_name) in
        linksys,audi|\
        linksys,viper)
index 6e8e31084974c43da8c8e66c43483253c1ea6b5a..dd2266bdc860cd51b5873f04d7dd1849745a6a54 100755 (executable)
@@ -2,9 +2,7 @@
 
 START=99
 
-start() {
-       . /lib/functions.sh
-
+boot() {
        case $(board_name) in
        linksys,caiman |\
        linksys,cobra |\
index 60b93f72b3240a5382fcb5715be40bc17b80c0e4..807801a34faf53ec16f81096bc8afd1ac1195547 100755 (executable)
@@ -2,11 +2,10 @@
 
 START=99
 
-start() {
-       . /lib/functions.sh
-
-       local board=$(board_name)
-       if [ $board = "samknows,whitebox-v8" ]; then
+boot() {
+       case $(board_name) in
+       samknows,whitebox-v8)
                fw_setenv bootcount 0
-       fi
+               ;;
+       esac
 }