[OpenWrt-Devel] treewide: sync bootcount scripts across targets
diff mbox series

Message ID 20190810115903.1482-1-gch981213@gmail.com
State Accepted, archived
Delegated to: Chuanhong Guo
Headers show
Series
  • [OpenWrt-Devel] treewide: sync bootcount scripts across targets
Related show

Commit Message

Chuanhong Guo Aug. 10, 2019, 11:59 a.m. UTC
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    |  1 +
 target/linux/ipq40xx/base-files/etc/init.d/bootcount  |  4 +---
 target/linux/ipq806x/base-files/etc/init.d/bootcount  |  4 +---
 target/linux/kirkwood/base-files/etc/init.d/bootcount |  4 +---
 target/linux/mvebu/base-files/etc/init.d/bootcount    |  4 +---
 target/linux/ramips/base-files/etc/init.d/bootcount   | 11 +++++------
 6 files changed, 10 insertions(+), 18 deletions(-)

Patch
diff mbox series

diff --git a/target/linux/ath79/base-files/etc/init.d/bootcount b/target/linux/ath79/base-files/etc/init.d/bootcount
index b71fbf9a69..c734fd9d33 100755
--- a/target/linux/ath79/base-files/etc/init.d/bootcount
+++ b/target/linux/ath79/base-files/etc/init.d/bootcount
@@ -1,4 +1,5 @@ 
 #!/bin/sh /etc/rc.common
+
 START=99
 
 boot() {
diff --git a/target/linux/ipq40xx/base-files/etc/init.d/bootcount b/target/linux/ipq40xx/base-files/etc/init.d/bootcount
index f2d76f125f..b9d625e296 100755
--- a/target/linux/ipq40xx/base-files/etc/init.d/bootcount
+++ b/target/linux/ipq40xx/base-files/etc/init.d/bootcount
@@ -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)" ] &&\
diff --git a/target/linux/ipq806x/base-files/etc/init.d/bootcount b/target/linux/ipq806x/base-files/etc/init.d/bootcount
index 6a5a6d52ad..d0bf708e66 100755
--- a/target/linux/ipq806x/base-files/etc/init.d/bootcount
+++ b/target/linux/ipq806x/base-files/etc/init.d/bootcount
@@ -2,9 +2,7 @@ 
 
 START=99
 
-start() {
-	. /lib/functions.sh
-
+boot() {
 	case $(board_name) in
 	linksys,ea8500)
 		mtd resetbc s_env || true
diff --git a/target/linux/kirkwood/base-files/etc/init.d/bootcount b/target/linux/kirkwood/base-files/etc/init.d/bootcount
index 20fb3a425c..478f3d0134 100755
--- a/target/linux/kirkwood/base-files/etc/init.d/bootcount
+++ b/target/linux/kirkwood/base-files/etc/init.d/bootcount
@@ -2,9 +2,7 @@ 
 
 START=99
 
-start() {
-	. /lib/functions.sh
-
+boot() {
 	case $(board_name) in
 	linksys,audi|\
 	linksys,viper)
diff --git a/target/linux/mvebu/base-files/etc/init.d/bootcount b/target/linux/mvebu/base-files/etc/init.d/bootcount
index 6e8e310849..dd2266bdc8 100755
--- a/target/linux/mvebu/base-files/etc/init.d/bootcount
+++ b/target/linux/mvebu/base-files/etc/init.d/bootcount
@@ -2,9 +2,7 @@ 
 
 START=99
 
-start() {
-	. /lib/functions.sh
-
+boot() {
 	case $(board_name) in
 	linksys,caiman |\
 	linksys,cobra |\
diff --git a/target/linux/ramips/base-files/etc/init.d/bootcount b/target/linux/ramips/base-files/etc/init.d/bootcount
index 60b93f72b3..807801a34f 100755
--- a/target/linux/ramips/base-files/etc/init.d/bootcount
+++ b/target/linux/ramips/base-files/etc/init.d/bootcount
@@ -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
 }