--- /dev/null
+#!/bin/sh
+exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
#!/command/with-contenv sh
-rm -rf /var/run/dbus/dbus.pid
echo "Starting dbus"
-exec dbus-daemon --system --nofork
+exec s6-notifyoncheck dbus-daemon --system --nofork --nopidfile
--- /dev/null
+#!/bin/sh
+state="$(dbus-send --system --dest=org.freedesktop.Avahi --print-reply / org.freedesktop.Avahi.Server.GetState | grep int32 | awk '{printf $2}')"
+
+# Avahi will return 'state=2' when 'Server startup complete'
+if [ "$state" = 2 ]; then
+ exit 0
+else
+ exit 1
+fi
+
#!/command/with-contenv sh
-while [ ! -f /var/run/dbus/dbus.pid ]; do
- echo "s6-rc: warning: dbus is not running, sleeping for 1 second before trying to start avahi"
- sleep 1
-done
echo "Starting avahi"
-exec avahi-daemon --no-chroot
+exec s6-notifyoncheck avahi-daemon --no-chroot
--- /dev/null
+#!/bin/sh
+exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
#!/command/with-contenv sh
-rm -rf /var/run/dbus/dbus.pid
echo "Starting dbus"
-exec dbus-daemon --system --nofork
+exec s6-notifyoncheck dbus-daemon --system --nofork --nopidfile
--- /dev/null
+#!/bin/sh
+state="$(dbus-send --system --dest=org.freedesktop.Avahi --print-reply / org.freedesktop.Avahi.Server.GetState | grep int32 | awk '{printf $2}')"
+
+# Avahi will return 'state=2' when 'Server startup complete'
+if [ "$state" = 2 ]; then
+ exit 0
+else
+ exit 1
+fi
+
#!/command/with-contenv sh
-while [ ! -f /var/run/dbus/dbus.pid ]; do
- echo "s6-rc: warning: dbus is not running, sleeping for 1 second before trying to start avahi"
- sleep 1
-done
echo "Starting avahi"
-exec avahi-daemon --no-chroot
+exec s6-notifyoncheck avahi-daemon --no-chroot