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 <dywi@mailerd.de>
Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
André Erdmann 2014-10-26 18:41:43 +01:00 committed by Peter Korsgaard
parent 7541ec8127
commit 5f617ffa17
12 changed files with 27 additions and 27 deletions

View File

@ -4,12 +4,12 @@ case "$1" in
start) start)
echo -n "Starting acpid: " echo -n "Starting acpid: "
start-stop-daemon -S -q -m -b -p /var/run/acpid.pid --exec /usr/sbin/acpid -- -n 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) stop)
echo -n "Stopping acpid: " echo -n "Stopping acpid: "
start-stop-daemon -K -q -p /var/run/acpid.pid start-stop-daemon -K -q -p /var/run/acpid.pid
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart) restart)
"$0" stop "$0" stop

View File

@ -16,12 +16,12 @@ case "$1" in
fi fi
echo -n "Starting domain name daemon: " echo -n "Starting domain name daemon: "
start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo -n "Stopping domain name daemon: " echo -n "Stopping domain name daemon: "
rndc stop || start-stop-daemon -K -x $DAEMON rndc stop || start-stop-daemon -K -x $DAEMON
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart) restart)
$0 stop || true $0 stop || true

View File

@ -30,12 +30,12 @@ case "$1" in
start) start)
echo -n "Starting DHCP relay: " echo -n "Starting DHCP relay: "
start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo -n "Stopping DHCP relay: " echo -n "Stopping DHCP relay: "
start-stop-daemon -K -x /usr/sbin/dhcrelay start-stop-daemon -K -x /usr/sbin/dhcrelay
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart | force-reload) restart | force-reload)
$0 stop $0 stop

View File

@ -18,12 +18,12 @@ case "$1" in
test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/ test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo -n "Stopping DHCP server: dhcpd3" echo -n "Stopping DHCP server: dhcpd3"
start-stop-daemon -K -x /usr/sbin/dhcpd start-stop-daemon -K -x /usr/sbin/dhcpd
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart | force-reload) restart | force-reload)
$0 stop $0 stop

View File

@ -7,12 +7,12 @@ case "$1" in
start) start)
echo -n "Starting dnsmasq: " echo -n "Starting dnsmasq: "
start-stop-daemon -S -x /usr/sbin/dnsmasq start-stop-daemon -S -x /usr/sbin/dnsmasq
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo -n "Stopping dnsmasq: " echo -n "Stopping dnsmasq: "
start-stop-daemon -K -q -x /usr/sbin/dnsmasq start-stop-daemon -K -q -x /usr/sbin/dnsmasq
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart|reload) restart|reload)
$0 stop $0 stop

View File

@ -13,12 +13,12 @@ start() {
umask 077 umask 077
start-stop-daemon -S -q -p /var/run/dropbear.pid \ start-stop-daemon -S -q -p /var/run/dropbear.pid \
--exec /usr/sbin/dropbear -- $DROPBEAR_ARGS --exec /usr/sbin/dropbear -- $DROPBEAR_ARGS
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
stop() { stop() {
echo -n "Stopping dropbear sshd: " echo -n "Stopping dropbear sshd: "
start-stop-daemon -K -q -p /var/run/dropbear.pid start-stop-daemon -K -q -p /var/run/dropbear.pid
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
restart() { restart() {
stop stop

View File

@ -6,12 +6,12 @@ case "$1" in
start) start)
echo -n "Starting haveged: " echo -n "Starting haveged: "
start-stop-daemon -S -x /usr/sbin/haveged -- -w 1024 -r 0 start-stop-daemon -S -x /usr/sbin/haveged -- -w 1024 -r 0
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo -n "Stopping haveged: " echo -n "Stopping haveged: "
start-stop-daemon -K -x /usr/sbin/haveged start-stop-daemon -K -x /usr/sbin/haveged
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart|reload) restart|reload)
$0 stop $0 stop

View File

@ -16,12 +16,12 @@ case "$1" in
start) start)
echo "Starting inadyn: " echo "Starting inadyn: "
start-stop-daemon -S -x /usr/bin/inadyn start-stop-daemon -S -x /usr/bin/inadyn
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo "Stopping inadyn: " echo "Stopping inadyn: "
start-stop-daemon -q -K -x /usr/bin/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 rm -f /var/run/inadyn/inadyn.pid
;; ;;
restart) restart)

View File

@ -7,12 +7,12 @@ case "$1" in
start) start)
echo -n "Starting openntpd: " echo -n "Starting openntpd: "
start-stop-daemon -S -x /usr/sbin/ntpd start-stop-daemon -S -x /usr/sbin/ntpd
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
echo -n "Stopping openntpd: " echo -n "Stopping openntpd: "
start-stop-daemon -K -x /usr/sbin/ntpd start-stop-daemon -K -x /usr/sbin/ntpd
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart) restart)
"$0" stop "$0" stop

View File

@ -7,21 +7,21 @@ mkdir -p /var/log/samba
start() { start() {
echo -n "Starting SMB services: " echo -n "Starting SMB services: "
smbd -D smbd -D
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
echo -n "Starting NMB services: " echo -n "Starting NMB services: "
nmbd -D nmbd -D
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
stop() { stop() {
echo -n "Shutting down SMB services: " echo -n "Shutting down SMB services: "
kill -9 `pidof smbd` kill -9 `pidof smbd`
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
echo -n "Shutting down NMB services: " echo -n "Shutting down NMB services: "
kill -9 `pidof nmbd` kill -9 `pidof nmbd`
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
restart() { restart() {
@ -32,7 +32,7 @@ restart() {
reload() { reload() {
echo -n "Reloading smb.conf file: " echo -n "Reloading smb.conf file: "
kill -HUP `pidof smbd` kill -HUP `pidof smbd`
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
case "$1" in case "$1" in

View File

@ -7,12 +7,12 @@ case "$1" in
start) start)
echo -n "Starting shairport-sync: " echo -n "Starting shairport-sync: "
start-stop-daemon -S -q -m -b -p /var/run/shairport-sync.pid --exec /usr/bin/shairport-sync -- $OPTIONS 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) stop)
echo -n "Stopping shairport-sync: " echo -n "Stopping shairport-sync: "
start-stop-daemon -K -q -p /var/run/shairport-sync.pid start-stop-daemon -K -q -p /var/run/shairport-sync.pid
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart) restart)
$0 stop $0 stop

View File

@ -11,12 +11,12 @@ PIDFILE=/var/run/xbmc.pid
start() { start() {
echo -n "Starting XBMC: " echo -n "Starting XBMC: "
start-stop-daemon -S -q -b -m -p $PIDFILE --exec $BIN -- $XBMC $XBMC_ARGS 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() { stop() {
echo -n "Stopping XBMC: " echo -n "Stopping XBMC: "
start-stop-daemon -K -q -p $PIDFILE start-stop-daemon -K -q -p $PIDFILE
[ $? == 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
} }
restart() { restart() {
stop stop