mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-08 12:46:45 -09:00
package/libiio: refactor iiod init script
* Fix check-package issues and remove .checkpackageignore entry * Remove fixed wait in "restart", wait for process termination in "stop" instead * Print standard starting/stopping messages Signed-off-by: Fiona Klute <fiona.klute@gmx.de> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
bfca06b350
commit
6d2dbb4684
2 changed files with 44 additions and 19 deletions
|
|
@ -551,7 +551,6 @@ package/libgpiod/0001-build-add-a-configure-switch-for-building-examples.patch l
|
|||
package/libgsm/0001-Misc-fixes-from-Archlinux.patch lib_patch.Upstream
|
||||
package/libgtk3/0001-Remove-Gdk-dependency-from-gtk-encode-symbolic-svg.patch lib_patch.Upstream
|
||||
package/libhdhomerun/0001-dont-strip.patch lib_patch.Upstream
|
||||
package/libiio/S99iiod Shellcheck lib_sysv.Variables
|
||||
package/libiqrf/0001-cmake-handle-static-library-and-find-required-thread.patch lib_patch.Upstream
|
||||
package/libiqrf/0002-use-only-c-language.patch lib_patch.Upstream
|
||||
package/libjson/0001-fix-broken-makefile.patch lib_patch.Upstream
|
||||
|
|
|
|||
|
|
@ -1,29 +1,55 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Server-side demuxing by default
|
||||
IIOD_OPTS=-D
|
||||
DAEMON="iiod"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
[ -r /etc/default/iiod ] && . /etc/default/iiod
|
||||
# Server-side demuxing by default
|
||||
IIOD_OPTS="-D"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon --start --background --make-pidfile \
|
||||
--pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON" \
|
||||
-- $IIOD_OPTS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" --exec "/usr/sbin/$DAEMON"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||
--exec "/usr/sbin/$DAEMON"; do
|
||||
sleep 0.1
|
||||
done
|
||||
rm -f "$PIDFILE"
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting IIO Server Daemon"
|
||||
start-stop-daemon -S -b -q -m -p /var/run/iiod.pid -x /usr/sbin/iiod -- $IIOD_OPTS
|
||||
exit $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo "Stopping IIO Server Daemon"
|
||||
start-stop-daemon -K -q -p /var/run/iiod.pid 2>/dev/null
|
||||
exit $?
|
||||
;;
|
||||
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue