From: André Erdmann Date: Sun, 26 Oct 2014 17:41:43 +0000 (+0100) Subject: sysv init scripts: fix == bashism X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f617ffa17537d701a2f645f36895fa0d695d221;p=buildroot.git sysv init scripts: fix == bashism test a == b is not available in e.g. dash. Command(s) used for editing: q=\[\"\'\] operand="${q}?[$]?[a-zA-Z0-9_\?]+${q}?" ## doesn't detect ${VAR} test_expr="(\[\s+${operand}\s+)==(\s+${operand}\s+\])" find . -type f -name '[SK][0-9][0-9]*' | \ xargs sed -r -e "s@${test_expr}@\1=\2@g" -i Signed-off-by: André Erdmann Acked-by: Gustavo Zacarias Signed-off-by: Peter Korsgaard --- diff --git a/package/acpid/S02acpid b/package/acpid/S02acpid index c2221fc3aa..0840305d1c 100755 --- a/package/acpid/S02acpid +++ b/package/acpid/S02acpid @@ -4,12 +4,12 @@ case "$1" in start) echo -n "Starting acpid: " start-stop-daemon -S -q -m -b -p /var/run/acpid.pid --exec /usr/sbin/acpid -- -n - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping acpid: " start-stop-daemon -K -q -p /var/run/acpid.pid - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart) "$0" stop diff --git a/package/bind/S81named b/package/bind/S81named index 4010886411..4581eb362a 100644 --- a/package/bind/S81named +++ b/package/bind/S81named @@ -16,12 +16,12 @@ case "$1" in fi echo -n "Starting domain name daemon: " start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping domain name daemon: " rndc stop || start-stop-daemon -K -x $DAEMON - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart) $0 stop || true diff --git a/package/dhcp/S80dhcp-relay b/package/dhcp/S80dhcp-relay index 2a632ef950..9faa13d568 100755 --- a/package/dhcp/S80dhcp-relay +++ b/package/dhcp/S80dhcp-relay @@ -30,12 +30,12 @@ case "$1" in start) echo -n "Starting DHCP relay: " start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping DHCP relay: " start-stop-daemon -K -x /usr/sbin/dhcrelay - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart | force-reload) $0 stop diff --git a/package/dhcp/S80dhcp-server b/package/dhcp/S80dhcp-server index 5280c31008..fb99f9ab33 100755 --- a/package/dhcp/S80dhcp-server +++ b/package/dhcp/S80dhcp-server @@ -18,12 +18,12 @@ case "$1" in test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/ test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping DHCP server: dhcpd3" start-stop-daemon -K -x /usr/sbin/dhcpd - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart | force-reload) $0 stop diff --git a/package/dnsmasq/S80dnsmasq b/package/dnsmasq/S80dnsmasq index 2ff0206be1..587751e5bf 100755 --- a/package/dnsmasq/S80dnsmasq +++ b/package/dnsmasq/S80dnsmasq @@ -7,12 +7,12 @@ case "$1" in start) echo -n "Starting dnsmasq: " start-stop-daemon -S -x /usr/sbin/dnsmasq - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping dnsmasq: " start-stop-daemon -K -q -x /usr/sbin/dnsmasq - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart|reload) $0 stop diff --git a/package/dropbear/S50dropbear b/package/dropbear/S50dropbear index f36165ae48..2694931d01 100644 --- a/package/dropbear/S50dropbear +++ b/package/dropbear/S50dropbear @@ -13,12 +13,12 @@ start() { umask 077 start-stop-daemon -S -q -p /var/run/dropbear.pid \ --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } stop() { echo -n "Stopping dropbear sshd: " start-stop-daemon -K -q -p /var/run/dropbear.pid - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } restart() { stop diff --git a/package/haveged/S21haveged b/package/haveged/S21haveged index f17cd2907a..1918b2763e 100755 --- a/package/haveged/S21haveged +++ b/package/haveged/S21haveged @@ -6,12 +6,12 @@ case "$1" in start) echo -n "Starting haveged: " start-stop-daemon -S -x /usr/sbin/haveged -- -w 1024 -r 0 - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping haveged: " start-stop-daemon -K -x /usr/sbin/haveged - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart|reload) $0 stop diff --git a/package/inadyn/S70inadyn b/package/inadyn/S70inadyn index 96e75329c4..b20048ce8c 100644 --- a/package/inadyn/S70inadyn +++ b/package/inadyn/S70inadyn @@ -16,12 +16,12 @@ case "$1" in start) echo "Starting inadyn: " start-stop-daemon -S -x /usr/bin/inadyn - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo "Stopping inadyn: " start-stop-daemon -q -K -x /usr/bin/inadyn - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" rm -f /var/run/inadyn/inadyn.pid ;; restart) diff --git a/package/openntpd/S49ntp b/package/openntpd/S49ntp index 99e0f68af2..8bbe7955ad 100755 --- a/package/openntpd/S49ntp +++ b/package/openntpd/S49ntp @@ -7,12 +7,12 @@ case "$1" in start) echo -n "Starting openntpd: " start-stop-daemon -S -x /usr/sbin/ntpd - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping openntpd: " start-stop-daemon -K -x /usr/sbin/ntpd - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart) "$0" stop diff --git a/package/samba4/S91smb b/package/samba4/S91smb index 0cd0057a28..ce14e19df9 100644 --- a/package/samba4/S91smb +++ b/package/samba4/S91smb @@ -7,21 +7,21 @@ mkdir -p /var/log/samba start() { echo -n "Starting SMB services: " smbd -D - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" echo -n "Starting NMB services: " nmbd -D - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } stop() { echo -n "Shutting down SMB services: " kill -9 `pidof smbd` - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" echo -n "Shutting down NMB services: " kill -9 `pidof nmbd` - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } restart() { @@ -32,7 +32,7 @@ restart() { reload() { echo -n "Reloading smb.conf file: " kill -HUP `pidof smbd` - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } case "$1" in diff --git a/package/shairport-sync/S99shairport-sync b/package/shairport-sync/S99shairport-sync index 8e88c1bdf8..31359fc25e 100644 --- a/package/shairport-sync/S99shairport-sync +++ b/package/shairport-sync/S99shairport-sync @@ -7,12 +7,12 @@ case "$1" in start) echo -n "Starting shairport-sync: " start-stop-daemon -S -q -m -b -p /var/run/shairport-sync.pid --exec /usr/bin/shairport-sync -- $OPTIONS - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop) echo -n "Stopping shairport-sync: " start-stop-daemon -K -q -p /var/run/shairport-sync.pid - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart) $0 stop diff --git a/package/xbmc/S50xbmc b/package/xbmc/S50xbmc index 312452bb7f..80cc0171a7 100755 --- a/package/xbmc/S50xbmc +++ b/package/xbmc/S50xbmc @@ -11,12 +11,12 @@ PIDFILE=/var/run/xbmc.pid start() { echo -n "Starting XBMC: " start-stop-daemon -S -q -b -m -p $PIDFILE --exec $BIN -- $XBMC $XBMC_ARGS - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } stop() { echo -n "Stopping XBMC: " start-stop-daemon -K -q -p $PIDFILE - [ $? == 0 ] && echo "OK" || echo "FAIL" + [ $? = 0 ] && echo "OK" || echo "FAIL" } restart() { stop