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/dmraid/0001-fix-compilation-under-musl.patch Upstream
package/dmraid/S20dmraid Variables
package/dnsmasq/S80dnsmasq Shellcheck Variables
package/dnsmasq/S80dnsmasq Shellcheck
package/docker-engine/S60dockerd Indent Shellcheck Variables
package/docopt-cpp/0001-only-build-one-target-use-BUILD_SHARED_LIBS-where-appropriate.patch Upstream
package/domoticz/S99domoticz Shellcheck

View File

@ -1,16 +1,20 @@
#!/bin/sh
DAEMON="dnsmasq"
PIDFILE="/var/run/$DAEMON.pid"
[ -f /etc/dnsmasq.conf ] || exit 0
case "$1" in
start)
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"
;;
stop)
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"
;;
restart|reload)