[OpenWrt-Devel] [PATCHv2] ubox: Run init script through shellcheck

Rosen Penev rosenp at gmail.com
Wed Jul 24 14:04:17 EDT 2019


Warnings fixed:

SC2004: $/${} is unnecessary on arithmetic variables.
SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 v2: Fixed mistake with executing PIDCOUNT.
 package/system/ubox/Makefile       | 2 +-
 package/system/ubox/files/log.init | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile
index 6e67951929..d303603c0d 100644
--- a/package/system/ubox/Makefile
+++ b/package/system/ubox/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ubox
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubox.git
diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init
index ba9c124c8b..32821c4920 100644
--- a/package/system/ubox/files/log.init
+++ b/package/system/ubox/files/log.init
@@ -32,7 +32,7 @@ validate_log_daemon()
 
 start_service_daemon()
 {
-	[ $log_buffer_size -eq 0 -a $log_size -gt 0 ] && log_buffer_size=$log_size
+	[ $log_buffer_size -eq 0 ] && [ $log_size -gt 0 ] && log_buffer_size=$log_size
 	[ $log_buffer_size -eq 0 ] && log_buffer_size=64
 	procd_open_instance
 	procd_set_param command "/sbin/logd"
@@ -43,7 +43,7 @@ start_service_daemon()
 
 start_service_file()
 {
-	PIDCOUNT="$(( ${PIDCOUNT} + 1))"
+	PIDCOUNT=$((PIDCOUNT + 1))
 	local pid_file="/var/run/logread.${PIDCOUNT}.pid"
 
 	[ "$2" = 0 ] || {
@@ -62,7 +62,7 @@ start_service_file()
 
 start_service_remote()
 {
-	PIDCOUNT="$(( ${PIDCOUNT} + 1))"
+	PIDCOUNT=$((PIDCOUNT + 1))
 	local pid_file="/var/run/logread.${PIDCOUNT}.pid"
 
 	[ "$2" = 0 ] || {
-- 
2.17.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list