All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/libiio: refactor iiod init script
@ 2025-12-27 22:37 Fiona Klute via buildroot
  2025-12-27 22:37 ` [Buildroot] [PATCH 2/2] package/libiio: move iiod init script from S99 to S60 Fiona Klute via buildroot
  2025-12-29 16:31 ` [Buildroot] [PATCH 1/2] package/libiio: refactor iiod init script Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Fiona Klute via buildroot @ 2025-12-27 22:37 UTC (permalink / raw)
  To: buildroot; +Cc: Paul Cercueil, Fiona Klute

* 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>
---
 .checkpackageignore    |  1 -
 package/libiio/S99iiod | 62 ++++++++++++++++++++++++++++++------------
 2 files changed, 44 insertions(+), 19 deletions(-)

diff --git a/.checkpackageignore b/.checkpackageignore
index d28b22ad74..bafc256c37 100644
--- a/.checkpackageignore
+++ b/.checkpackageignore
@@ -552,7 +552,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
diff --git a/package/libiio/S99iiod b/package/libiio/S99iiod
index df2f763461..b1d56a73fa 100644
--- a/package/libiio/S99iiod
+++ b/package/libiio/S99iiod
@@ -1,29 +1,55 @@
 #!/bin/sh
 
+DAEMON="iiod"
+PIDFILE="/var/run/$DAEMON.pid"
+
 # Server-side demuxing by default
-IIOD_OPTS=-D
+IIOD_OPTS="-D"
 
-[ -r /etc/default/iiod ] && . /etc/default/iiod
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
 
-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 $?
-		;;
+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)
-		echo "Stopping IIO Server Daemon"
-		start-stop-daemon -K -q -p /var/run/iiod.pid 2>/dev/null
-		exit $?
-		;;
+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)
-		$0 stop
-		sleep 1
-		$0 start
-		;;
+restart() {
+	stop
+	start
+}
 
+case "$1" in
+	start|stop|restart)
+		"$1";;
 	*)
 		echo "Usage: $0 {start|stop|restart}"
 		exit 1
-- 
2.51.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-29 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-27 22:37 [Buildroot] [PATCH 1/2] package/libiio: refactor iiod init script Fiona Klute via buildroot
2025-12-27 22:37 ` [Buildroot] [PATCH 2/2] package/libiio: move iiod init script from S99 to S60 Fiona Klute via buildroot
2025-12-29 16:31 ` [Buildroot] [PATCH 1/2] package/libiio: refactor iiod init script Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.