sysv init scripts: fix == bashism
authorAndré Erdmann <dywi@mailerd.de>
Sun, 26 Oct 2014 17:41:43 +0000 (18:41 +0100)
committerPeter Korsgaard <peter@korsgaard.com>
Tue, 11 Nov 2014 22:08:46 +0000 (23:08 +0100)
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 <dywi@mailerd.de>
Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
12 files changed:
package/acpid/S02acpid
package/bind/S81named
package/dhcp/S80dhcp-relay
package/dhcp/S80dhcp-server
package/dnsmasq/S80dnsmasq
package/dropbear/S50dropbear
package/haveged/S21haveged
package/inadyn/S70inadyn
package/openntpd/S49ntp
package/samba4/S91smb
package/shairport-sync/S99shairport-sync
package/xbmc/S50xbmc

index c2221fc3aae19d6de93deffbfbd1d7f36ef6bfea..0840305d1c8b7143380f7932d1b455732d63f596 100755 (executable)
@@ -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
index 401088641128f11179f0fed1521e4956f972d567..4581eb362af8ec8a5fd34b503519222c8c9cbc71 100644 (file)
@@ -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
index 2a632ef95083ff02bcde1aa7db67589c45c61d49..9faa13d568f82bf4fda8220811c89d500f391c69 100755 (executable)
@@ -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
index 5280c310084b9c78e712eb72bcc974fe348ec367..fb99f9ab335ca9c785930d4c5b101614a3d7123d 100755 (executable)
@@ -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
index 2ff0206be1a02e78eef3b5bf5b926172b777ee6c..587751e5bf00eca75ef80beb90ab32f3cfb7b6c8 100755 (executable)
@@ -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
index f36165ae487e1186b1f1347d89c8e987f36ed673..2694931d017491fb3d67b2f10c5de7f497dc2258 100644 (file)
@@ -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
index f17cd2907a4484c51be6bfe65a7b9be228429c84..1918b2763eadc748490c050211eac1d522e17ea7 100755 (executable)
@@ -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
index 96e75329c41bc120b9ae30ddf72fdeb0d1e4ddca..b20048ce8c0d949255c07a007649c5e4c97ac5f9 100644 (file)
@@ -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)
index 99e0f68af2c645b2c09bcefce0897bcb79838776..8bbe7955adf0cdbfb8ea33fcfc08efd88934d4fc 100755 (executable)
@@ -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
index 0cd0057a28e31483fedcd09bfc59607f26ff2593..ce14e19df94f1d8e4d31ef4fb4ce7f7b7b1ec215 100644 (file)
@@ -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
index 8e88c1bdf84a8e45b50716a7ff67a7987f977a8d..31359fc25ea4ec577cde5e2039bf869130ad9e10 100644 (file)
@@ -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
index 312452bb7fc555bfeaa14213dc23524bc4cf0e57..80cc0171a7931882faba70cb8341f858019c7fdd 100755 (executable)
@@ -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