package/dnsmasq: improve init script

- Use pidfile for more accurate process match
- Fix coding style issues to be able to drop a problem reported by
  check-package on missing variables

Signed-off-by: Konstantin Menyaev <KAMenyaev@sberdevices.ru>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Konstantin Menyaev 2023-06-16 04:23:24 +03:00 committed by Thomas Petazzoni
parent 0b9877a4b9
commit 0c4c7da2f3
2 changed files with 7 additions and 3 deletions

View File

@ -359,7 +359,7 @@ package/dmalloc/0004-Makefile-use-the-configure-detected-or-user-supplied.patch
package/dmalloc/0005-configure-use-LD-instead-of-hard-coding-ld.patch Upstream package/dmalloc/0005-configure-use-LD-instead-of-hard-coding-ld.patch Upstream
package/dmraid/0001-fix-compilation-under-musl.patch Upstream package/dmraid/0001-fix-compilation-under-musl.patch Upstream
package/dmraid/S20dmraid Variables package/dmraid/S20dmraid Variables
package/dnsmasq/S80dnsmasq Shellcheck Variables package/dnsmasq/S80dnsmasq Shellcheck
package/docker-engine/S60dockerd Indent Shellcheck Variables package/docker-engine/S60dockerd Indent Shellcheck Variables
package/docopt-cpp/0001-only-build-one-target-use-BUILD_SHARED_LIBS-where-appropriate.patch Upstream package/docopt-cpp/0001-only-build-one-target-use-BUILD_SHARED_LIBS-where-appropriate.patch Upstream
package/domoticz/S99domoticz Shellcheck package/domoticz/S99domoticz Shellcheck

View File

@ -1,16 +1,20 @@
#!/bin/sh #!/bin/sh
DAEMON="dnsmasq"
PIDFILE="/var/run/$DAEMON.pid"
[ -f /etc/dnsmasq.conf ] || exit 0 [ -f /etc/dnsmasq.conf ] || exit 0
case "$1" in case "$1" in
start) start)
printf "Starting dnsmasq: " printf "Starting dnsmasq: "
start-stop-daemon -S -x /usr/sbin/dnsmasq start-stop-daemon -S -p "$PIDFILE" -x "/usr/sbin/$DAEMON" -- \
--pid-file="$PIDFILE"
[ $? = 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
stop) stop)
printf "Stopping dnsmasq: " printf "Stopping dnsmasq: "
start-stop-daemon -K -q -x /usr/sbin/dnsmasq start-stop-daemon -K -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON"
[ $? = 0 ] && echo "OK" || echo "FAIL" [ $? = 0 ] && echo "OK" || echo "FAIL"
;; ;;
restart|reload) restart|reload)