init scripts: don't test if binaries exist
cover init scripts: don't test if binaries exist
As discussed in the mailing list, it is useless to test if a binary file exists and/or is executable. Buildroot installs both the executable files and their init scripts as part of the same packages. But if it ever happens for some reason, the error message from start-stop-daemon or from the shell should be pretty clear.
If a variable containing the file name existed (e.g. DAEMON) and was used only once it was replaced by the full path of the binary file. Unused variables resulting from these simplifications were removed too.
Carlos Santos (26):
bind: don't test if the binary exists in the init script
dbus: don't test if the binary exists in the init script
dhcpcd: don't test if the binary exists in the init script
dmraid: don't test if the binary exists in the init script
dnsmasq: don't test if the binary exists in the init script
eudev: don't test if the binary exists in the init script
haveged: don't test if the binary exists in the init script
modem-manager: don't test if the binary exists in the init script
mpd: don't test if the binary exists in the init script
neard: don't test if the binary exists in the init script
netplug: don't test if the binary exists in the init script
netsnmp: don't test if the binaries exist in the init script
network-manager: don't test if the binary exists in the init script
nfs-utils: don't test if the binary exists in the init script
ntp: don't test if the binary exists in the init script
openntpd: don't test if the binary exists in the init script
openvpn: don't test if the binary exists in the init script
proftpd: don't test if the binary exists in the init script
prosody: don't test if the binary exists in the init script
squid: don't test if the binary exists in the init script
tinyhttpd: don't test if the binary exists in the init script
tpm2-abrmd: don't test if the binary exists in the init script
transmission: don't test if the binary exists in the init script
triggerhappy: don't test if the binary exists in the init script
tvheadend: don't test if the binary exists in the init script
upmpdcli: don't test if the binary exists in the init script
package/bind/S81named | 1 - package/dbus/S30dbus | 3 --- package/dhcpcd/S41dhcpcd | 1 - package/dmraid/S20dmraid | 2 -- package/dnsmasq/S80dnsmasq | 1 - package/eudev/S10udev | 6 +----- package/haveged/S21haveged | 2 -- package/modem-manager/S44modem-manager | 2 -- package/mpd/S95mpd | 1 - package/neard/S53neard | 6 +----- package/netplug/S29netplug | 2 -- package/netsnmp/S59snmpd | 3 --- package/network-manager/S45network-manager | 10 +--------- package/nfs-utils/S60nfs | 5 ----- package/ntp/S49ntp | 6 +----- package/openntpd/S49ntp | 1 - package/openvpn/S60openvpn | 6 +----- package/proftpd/S50proftpd | 4 +--- package/prosody/S50prosody | 6 +----- package/squid/S97squid | 1 - package/tinyhttpd/S85tinyhttpd | 1 - package/tpm2-abrmd/S80tpm2-abrmd | 8 ++------ package/transmission/S92transmission | 3 --- package/triggerhappy/S10triggerhappy | 6 +----- package/tvheadend/S99tvheadend | 5 +---- package/upmpdcli/S99upmpdcli | 6 +----- 26 files changed, 12 insertions(+), 86 deletions(-)
Signature · 1 line
2.14.3
PATCH 1/26 bind: don't test if the binary exists in the init script
The test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/bind/S81named | 1 - 1 file changed, 1 deletion(-)
package/bind/S81named +0 -1
@@ -3,7 +3,6 @@ CONFIG=/etc/bind/named.conf DAEMON=/usr/sbin/named -[ -x $DAEMON ] || exit 0 [ -f $CONFIG ] || exit 0 case "$1" in
Signature · 1 line
2.14.3
PATCH 2/26 dbus: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/dbus/S30dbus | 3 --- 1 file changed, 3 deletions(-)
package/dbus/S30dbus +0 -3
@@ -10,9 +10,6 @@ # pidfile: /var/run/messagebus.pid # -# Sanity checks. -[ -x /usr/bin/dbus-daemon ] || exit 0 - # Create needed directories. [ -d /var/run/dbus ] || mkdir -p /var/run/dbus [ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys
Signature · 1 line
2.14.3
PATCH 3/26 dhcpcd: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/dhcpcd/S41dhcpcd | 1 - 1 file changed, 1 deletion(-)
package/dhcpcd/S41dhcpcd +0 -1
@@ -7,7 +7,6 @@ DAEMON=/sbin/dhcpcd CONFIG=/etc/dhcpcd.conf PIDFILE=/var/run/dhcpcd.pid -[ -x $DAEMON ] || exit 0 [ -f $CONFIG ] || exit 0 case "$1" in
Signature · 1 line
2.14.3
PATCH 4/26 dmraid: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/dmraid/S20dmraid | 2 -- 1 file changed, 2 deletions(-)
package/dmraid/S20dmraid +0 -2
@@ -2,8 +2,6 @@ set -e -[ -x /usr/sbin/dmraid ] || exit 0 - # try to load module in case that hasn't been done yet modprobe dm-mod >/dev/null 2>&1
Signature · 1 line
2.14.3
PATCH 5/26 dnsmasq: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/dnsmasq/S80dnsmasq | 1 - 1 file changed, 1 deletion(-)
package/dnsmasq/S80dnsmasq +0 -1
@@ -1,6 +1,5 @@ #!/bin/sh -[ -x /usr/sbin/dnsmasq ] || exit 0 [ -f /etc/dnsmasq.conf ] || exit 0 case "$1" in
Signature · 1 line
2.14.3
PATCH 6/26 eudev: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits with error code 5 if the binary doesn't exist, which is silly. Buildroot installs both udevd and its init script as part of the same package. But if it ever happens for some reason, the error message "/sbin/udevd: No such file or directory" in the start case should be pretty clear.
Replace the UDEV_BIN variable, which was used only once, by the full path of the binary file.
--- package/eudev/S10udev | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/eudev/S10udev +1 -5
@@ -16,10 +16,6 @@ # /dev/zero, /dev/null -- that's needed to boot and run this script. # -# Check for missing binaries -UDEV_BIN=/sbin/udevd -test -x $UDEV_BIN || exit 5 - # Check for config file and read it UDEV_CONFIG=/etc/udev/udev.conf test -r $UDEV_CONFIG || exit 6
@@ -29,7 +25,7 @@ case "$1" in start) printf "Populating %s using udev: " "${udev_root:-/dev}" [ -e /proc/sys/kernel/hotplug ] && printf '\000\000\000\000' > /proc/sys/kernel/hotplug - $UDEV_BIN -d || { echo "FAIL"; exit 1; } + /sbin/udevd -d || { echo "FAIL"; exit 1; } udevadm trigger --type=subsystems --action=add udevadm trigger --type=devices --action=add udevadm settle --timeout=30 || echo "udevadm settle failed"
Signature · 1 line
2.14.3
PATCH 7/26 haveged: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/haveged/S21haveged | 2 -- 1 file changed, 2 deletions(-)
package/haveged/S21haveged +0 -2
@@ -1,7 +1,5 @@ #!/bin/sh -[ -x /usr/sbin/haveged ] || exit 0 - case "$1" in start) printf "Starting haveged: "
Signature · 1 line
2.14.3
PATCH 8/26 modem-manager: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Drop the MODEMMANAGER_BIN variable, which was never initialized.
--- package/modem-manager/S44modem-manager | 2 -- 1 file changed, 2 deletions(-)
package/modem-manager/S44modem-manager +0 -2
@@ -5,8 +5,6 @@ PIDFILE=/var/run/ModemManager.pid -[ -x $MODEMMANAGER_BIN ] || exit 0 - start() { printf "Starting ModemManager: " umask 077
Signature · 1 line
2.14.3
PATCH 8/26 modem-manager: don't test if the binary exists in the init script
Quoted 7 lines
The test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Drop the
MODEMMANAGER_BINvariable, which was never initialized.Signed-off-by Carlos Santos <[email protected]>---
...
package/modem-manager/S44modem-manager line 10
Quoted 10 lines
+++ b/package/modem-manager/S44modem-manager
package/modem-manager/S44modem-manager +0
-2@@ -5,8 +5,6 @@ PIDFILE=/var/run/ModemManager.pid -[ -x $MODEMMANAGER_BIN ] || exit 0 - start() { printf "Starting ModemManager: " umask 077
Kind regards,
Petr
PATCH 9/26 mpd: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/mpd/S95mpd | 1 - 1 file changed, 1 deletion(-)
package/mpd/S95mpd +0 -1
@@ -1,7 +1,6 @@ #!/bin/sh # Sanity checks -test -f /usr/bin/mpd || exit 0 test -f /etc/mpd.conf || exit 0 start() {
Signature · 1 line
2.14.3
PATCH 10/26 neard: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/neard/S53neard | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/neard/S53neard +1 -5
@@ -4,15 +4,11 @@ # NAME=neard -DAEMON=/usr/libexec/nfc/$NAME - -# Exit gracefully if the package has been removed -[ -x $DAEMON ] || exit 0 case "$1" in start) printf "Starting $NAME: " - start-stop-daemon -S -q -p /var/run/${NAME}.pid -x $DAEMON -- -d '*' + start-stop-daemon -S -q -p /var/run/${NAME}.pid -x /usr/libexec/nfc/neard -- -d '*' echo "OK" ;; stop)
Signature · 1 line
2.14.3
PATCH 11/26 netplug: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/netplug/S29netplug | 2 -- 1 file changed, 2 deletions(-)
package/netplug/S29netplug +0 -2
@@ -32,8 +32,6 @@ elif [ ! -f /etc/network/interfaces ]; then exit 0 fi -[ -x /sbin/netplugd ] || exit 0 - if [ -f /etc/sysconfig/netplugd ]; then . /etc/sysconfig/netplugd fi
Signature · 1 line
2.14.3
PATCH 12/26 netsnmp: don't test if the binaries exist in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/netsnmp/S59snmpd | 3 --- 1 file changed, 3 deletions(-)
package/netsnmp/S59snmpd +0 -3
@@ -14,9 +14,6 @@ export PATH=/sbin:/usr/sbin:/bin:/usr/bin -test -x /usr/sbin/snmpd || exit 0 -test -x /usr/sbin/snmptrapd || exit 0 - # Defaults export MIBDIRS=/usr/share/snmp/mibs SNMPDRUN=yes
Signature · 1 line
2.14.3
PATCH 13/26 network-manager: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the NETWORKMANAGER_BIN variable, which was used only once, by the full path of the binary file.
Drop the now useless variables prefix, exec_prefix and sbindir.
--- package/network-manager/S45network-manager | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
package/network-manager/S45network-manager +1 -9
@@ -3,21 +3,13 @@ # Allow a few customizations from a config file test -r /etc/default/NetworkManager && . /etc/default/NetworkManager -prefix=/usr -exec_prefix=/usr -sbindir=${exec_prefix}/sbin - -NETWORKMANAGER_BIN=${sbindir}/NetworkManager - -[ -x $NETWORKMANAGER_BIN ] || exit 0 - PID=`pidof NetworkManager` case "$1" in start) printf "Starting NetworkManager ... " [ ! -d /var/run/NetworkManager ] && install -d /var/run/NetworkManager if [ -z "$PID" ]; then - $NETWORKMANAGER_BIN $NETWORKMANAGER_ARGS + /usr/sbin/NetworkManager $NETWORKMANAGER_ARGS fi if [ ! -z "$PID" -o $? -gt 0 ]; then echo "failed!"
Signature · 1 line
2.14.3
PATCH 14/26 nfs-utils: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/nfs-utils/S60nfs | 5 ----- 1 file changed, 5 deletions(-)
package/nfs-utils/S60nfs +0 -5
@@ -3,11 +3,6 @@ # nfs This shell script takes care of starting and stopping # the NFS services. Stolen from RedHat FC5. -[ -x /usr/sbin/rpc.statd ] || exit 0 -[ -x /usr/sbin/rpc.nfsd ] || exit 0 -[ -x /usr/sbin/rpc.mountd ] || exit 0 -[ -x /usr/sbin/exportfs ] || exit 0 - mkdir -p /var/lock/subsys mkdir -p /run/nfs/sm mkdir -p /run/nfs/sm.bak
Signature · 1 line
2.14.3
PATCH 15/26 ntp: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/ntp/S49ntp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/ntp/S49ntp +1 -5
@@ -1,10 +1,6 @@ #! /bin/sh NAME=ntpd -DAEMON=/usr/sbin/$NAME - -# Gracefully exit if the package has been removed. -test -x $DAEMON || exit 0 # Read config file if it is present. if [ -r /etc/default/$NAME ]
@@ -15,7 +11,7 @@ fi case "$1" in start) printf "Starting $NAME: " - start-stop-daemon -S -q -x $DAEMON -- -g + start-stop-daemon -S -q -x /usr/sbin/ntpd -- -g [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop)
Signature · 1 line
2.14.3
PATCH 16/26 openntpd: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/openntpd/S49ntp | 1 - 1 file changed, 1 deletion(-)
package/openntpd/S49ntp +0 -1
@@ -1,6 +1,5 @@ #!/bin/sh -[ -x /usr/sbin/ntpd ] || exit 0 [ -f /etc/ntpd.conf ] || exit 0 case "$1" in
Signature · 1 line
2.14.3
PATCH 17/26 openvpn: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/openvpn/S60openvpn | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/openvpn/S60openvpn +1 -5
@@ -7,13 +7,11 @@ test $DEBIAN_SCRIPT_DEBUG && set -v -x -DAEMON=/usr/sbin/openvpn CONFIG_DIR=/etc/openvpn -test -x $DAEMON || exit 0 test -d $CONFIG_DIR || exit 0 start_vpn () { - $DAEMON --daemon --writepid /var/run/openvpn.$NAME.pid \ + /usr/sbin/openvpn --daemon --writepid /var/run/openvpn.$NAME.pid \ --config $CONFIG_DIR/$NAME.conf --cd $CONFIG_DIR || printf " FAILED->" printf " $NAME" }
@@ -79,8 +77,6 @@ reload|force-reload) printf "(restarted)" else kill -HUP `cat $PIDFILE` || true -# start-stop-daemon --stop --signal HUP --quiet --oknodo \ -# --exec $DAEMON --pidfile $PIDFILE printf " $NAME" fi done
Signature · 1 line
2.14.3
PATCH 18/26 proftpd: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/proftpd/S50proftpd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
package/proftpd/S50proftpd +1 -3
@@ -1,15 +1,13 @@ #!/bin/sh -DAEMON=/usr/sbin/proftpd trap "" HUP trap "" TERM -test -f $DAEMON || exit 0 [ ! -d /var/run/proftpd ] && mkdir /var/run/proftpd [ ! -f /var/log/wtmp ] && touch /var/log/wtmp start() { printf "Starting ProFTPD: " - $DAEMON + /usr/sbin/proftpd if [ $? != 0 ]; then echo "FAILED" exit 1
Signature · 1 line
2.14.3
PATCH 19/26 prosody: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/prosody/S50prosody | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/prosody/S50prosody +1 -5
@@ -1,7 +1,6 @@ #! /bin/sh NAME=prosody -DAEMON=/usr/bin/$NAME # This must match the pidfile field in # /etc/prosody/prosody.cfg.lua
@@ -9,15 +8,12 @@ DAEMON=/usr/bin/$NAME PIDDIR=/var/run/$NAME PIDFILE=$PIDDIR/$NAME.pid -# Gracefully exit if the package has been removed. -test -x $DAEMON || exit 0 - case "$1" in start) printf "Starting $NAME: " mkdir -p $PIDDIR chown $NAME:$NAME $PIDDIR - start-stop-daemon -S -q -o -x $DAEMON -c $NAME + start-stop-daemon -S -q -o -x /usr/bin/prosody -c $NAME [ $? = 0 ] && echo "OK" || echo "FAIL" ;; stop)
Signature · 1 line
2.14.3
PATCH 20/26 squid: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/squid/S97squid | 1 - 1 file changed, 1 deletion(-)
package/squid/S97squid +0 -1
@@ -1,6 +1,5 @@ #!/bin/sh -[ -x /usr/sbin/squid ] || exit 0 [ -f /etc/squid.conf ] || exit 0 case "$1" in
Signature · 1 line
2.14.3
PATCH 21/26 tinyhttpd: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/tinyhttpd/S85tinyhttpd | 1 - 1 file changed, 1 deletion(-)
package/tinyhttpd/S85tinyhttpd +0 -1
@@ -3,7 +3,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=tinyhttpd -test -x /usr/sbin/$NAME || exit 0 mkdir -p /var/www case "$1" in
Signature · 1 line
2.14.3
PATCH 22/26 tpm2-abrmd: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. Buildroot installs both abrmd and its init script as part of the same package. But if it ever happens for some reason, the error message from start-stop-daemon should be pretty clear.
--- package/tpm2-abrmd/S80tpm2-abrmd | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
package/tpm2-abrmd/S80tpm2-abrmd +2 -6
@@ -3,14 +3,10 @@ my_name="$0" check_required_files() { - [ -x "$1" ] || { + [ -f "$1" ] || { echo "$my_name: $1 is missing" exit 1 } - [ -z "$2" ] || [ -f "$2" ] || { - echo "$my_name: $2 is missing" - exit 1 - } } check_device() {
@@ -50,7 +46,7 @@ stop() { echo "OK" } -check_required_files /usr/sbin/tpm2-abrmd /etc/dbus-1/system.d/tpm2-abrmd.conf +check_required_files /etc/dbus-1/system.d/tpm2-abrmd.conf # defaults DAEMON_OPTS="--tcti=device --logger=syslog --max-connections=20 --max-transient-objects=20 --fail-on-loaded-trans"
Signature · 1 line
2.14.3
PATCH 23/26 transmission: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
--- package/transmission/S92transmission | 3 --- 1 file changed, 3 deletions(-)
package/transmission/S92transmission +0 -3
@@ -51,9 +51,6 @@ DAEMON=$(which $NAME) PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME
Signature · 1 line
2.14.3
PATCH 24/26 triggerhappy: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/triggerhappy/S10triggerhappy | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/triggerhappy/S10triggerhappy +1 -5
@@ -1,18 +1,14 @@ #!/bin/sh NAME=thd -DAEMON=/usr/sbin/$NAME PIDFILE=/var/run/$NAME.pid DAEMON_ARGS="--daemon --triggers /etc/triggerhappy/triggers.d --socket /var/run/thd.socket --pidfile $PIDFILE --user nobody /dev/input/event*" -# Sanity checks -test -x $DAEMON || exit 0 - [ -r /etc/default/triggerhappy ] && . /etc/default/triggerhappy start() { printf "Starting $NAME: " - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS \ + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec /usr/sbin/thd -- $DAEMON_ARGS \ && echo "OK" || echo "FAIL" }
Signature · 1 line
2.14.3
PATCH 25/26 tvheadend: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/tvheadend/S99tvheadend | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
package/tvheadend/S99tvheadend +1 -4
@@ -5,11 +5,8 @@ PATH=/usr/sbin:/usr/bin:/sbin:/bin NAME=tvheadend -DAEMON=/usr/bin/$NAME PIDFILE=/var/run/$NAME.pid -[ -f "${DAEMON}" -a -x "${DAEMON}" ] || exit 0 - # Read configuration variable file if it is present [ -r "/etc/default/${NAME}" ] && . "/etc/default/${NAME}"
@@ -29,7 +26,7 @@ fi case "$1" in start) printf "Starting TVHeadend daemon: " - if start-stop-daemon -S -q -p ${PIDFILE} -m --exec "${DAEMON}" -- ${ARGS}; then + if start-stop-daemon -S -q -p ${PIDFILE} -m --exec /usr/bin/tvheadend -- ${ARGS}; then printf "OK\n" else printf "failed\n"
Signature · 1 line
2.14.3
PATCH 26/26 upmpdcli: don't test if the binary exists in the init script
In reply to Carlos SantosThe test doesn't make sense. It just exits without any error if the binary doesn't exist, which is silly.
Replace the DAEMON variable, which was used only once, by the full path of the binary file.
--- package/upmpdcli/S99upmpdcli | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
package/upmpdcli/S99upmpdcli +1 -5
@@ -1,17 +1,13 @@ #!/bin/sh NAME=upmpdcli -DAEMON=/usr/bin/$NAME CONFFILE=/etc/$NAME.conf PIDFILE=/var/run/$NAME.pid DAEMON_ARGS="-D -c $CONFFILE" -# Sanity checks -test -f $DAEMON || exit 0 - start() { printf "Starting $NAME: " - start-stop-daemon --start --quiet --background --exec $DAEMON \ + start-stop-daemon --start --quiet --background --exec /usr/bin/upmpdcli \ -- $DAEMON_ARGS \ && echo "OK" || echo "FAIL" }
Signature · 1 line
2.14.3
cover init scripts: don't test if binaries exist
In reply to Carlos SantosHello,
Quoted 19 lines · Carlos Santos
Carlos Santos (26):
bind: don't test if the binary exists in the init script
dbus: don't test if the binary exists in the init script
dhcpcd: don't test if the binary exists in the init script
dmraid: don't test if the binary exists in the init script
dnsmasq: don't test if the binary exists in the init script
eudev: don't test if the binary exists in the init script
haveged: don't test if the binary exists in the init script
modem-manager: don't test if the binary exists in the init script
mpd: don't test if the binary exists in the init script
neard: don't test if the binary exists in the init script
netplug: don't test if the binary exists in the init script
netsnmp: don't test if the binaries exist in the init script
network-manager: don't test if the binary exists in the init script
nfs-utils: don't test if the binary exists in the init script
ntp: don't test if the binary exists in the init script
openntpd: don't test if the binary exists in the init script
openvpn: don't test if the binary exists in the init script
proftpd: don't test if the binary exists in the init script
Quoted 8 lines
prosody: don't test if the binary exists in the init script
squid: don't test if the binary exists in the init script
tinyhttpd: don't test if the binary exists in the init script
tpm2-abrmd: don't test if the binary exists in the init script
transmission: don't test if the binary exists in the init script
triggerhappy: don't test if the binary exists in the init script
tvheadend: don't test if the binary exists in the init script
upmpdcli: don't test if the binary exists in the init script
Thanks, series applied to master!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
cover init scripts: don't test if binaries exist
In reply to Carlos SantosHi Carlos,
Quoted 5 lines
As discussed in the mailing list, it is useless to test if a binary file exists and/or is executable. Buildroot installs both the executable files and their init scripts as part of the same packages. But if it ever happens for some reason, the error message from start-stop-daemon or from the shell should be pretty clear.
This originated from Debian, where removing package keeps init files (among other files), that's why it's checked.
But for Buildroot it's really useless and confusing.
Quoted 3 lines
If a variable containing the file name existed (e.g. DAEMON) and was used only once it was replaced by the full path of the binary file. Unused variables resulting from these simplifications were removed too.
LGTM.
Kind regards,
Petr
Quoted 55 lines
Carlos Santos (26):
bind: don't test if the binary exists in the init script
dbus: don't test if the binary exists in the init script
dhcpcd: don't test if the binary exists in the init script
dmraid: don't test if the binary exists in the init script
dnsmasq: don't test if the binary exists in the init script
eudev: don't test if the binary exists in the init script
haveged: don't test if the binary exists in the init script
modem-manager: don't test if the binary exists in the init script
mpd: don't test if the binary exists in the init script
neard: don't test if the binary exists in the init script
netplug: don't test if the binary exists in the init script
netsnmp: don't test if the binaries exist in the init script
network-manager: don't test if the binary exists in the init script
nfs-utils: don't test if the binary exists in the init script
ntp: don't test if the binary exists in the init script
openntpd: don't test if the binary exists in the init script
openvpn: don't test if the binary exists in the init script
proftpd: don't test if the binary exists in the init script
prosody: don't test if the binary exists in the init script
squid: don't test if the binary exists in the init script
tinyhttpd: don't test if the binary exists in the init script
tpm2-abrmd: don't test if the binary exists in the init script
transmission: don't test if the binary exists in the init script
triggerhappy: don't test if the binary exists in the init script
tvheadend: don't test if the binary exists in the init script
upmpdcli: don't test if the binary exists in the init scriptpackage/bind/S81named | 1 - package/dbus/S30dbus | 3 --- package/dhcpcd/S41dhcpcd | 1 - package/dmraid/S20dmraid | 2 -- package/dnsmasq/S80dnsmasq | 1 - package/eudev/S10udev | 6 +----- package/haveged/S21haveged | 2 -- package/modem-manager/S44modem-manager | 2 -- package/mpd/S95mpd | 1 - package/neard/S53neard | 6 +----- package/netplug/S29netplug | 2 -- package/netsnmp/S59snmpd | 3 --- package/network-manager/S45network-manager | 10 +--------- package/nfs-utils/S60nfs | 5 ----- package/ntp/S49ntp | 6 +----- package/openntpd/S49ntp | 1 - package/openvpn/S60openvpn | 6 +----- package/proftpd/S50proftpd | 4 +--- package/prosody/S50prosody | 6 +----- package/squid/S97squid | 1 - package/tinyhttpd/S85tinyhttpd | 1 - package/tpm2-abrmd/S80tpm2-abrmd | 8 ++------ package/transmission/S92transmission | 3 --- package/triggerhappy/S10triggerhappy | 6 +----- package/tvheadend/S99tvheadend | 5 +---- package/upmpdcli/S99upmpdcli | 6 +----- 26 files changed, 12 insertions(+), 86 deletions(-)