[OpenWrt-Devel,PATCHv2] ubox: Run init script through shellcheck
diff mbox series

Message ID 20190724180417.12035-1-rosenp@gmail.com
State New
Headers show
Series
  • [OpenWrt-Devel,PATCHv2] ubox: Run init script through shellcheck
Related show

Commit Message

Rosen Penev July 24, 2019, 6:04 p.m. UTC
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@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(-)

Patch
diff mbox series

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 ] || {