mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
package/restorecond: Add new init script
The current restorecond upstream init script is no good fit for the user space generated by buildroot, so we provide our own one. Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
60bde2995b
commit
99896b841b
54
package/restorecond/S02restorecond
Normal file
54
package/restorecond/S02restorecond
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DAEMON=restorecond
|
||||||
|
PIDFILE=/var/run/$DAEMON.pid
|
||||||
|
|
||||||
|
RESTORECOND_ARGS=""
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
||||||
|
|
||||||
|
start()
|
||||||
|
{
|
||||||
|
printf 'Starting %s: ' "$DAEMON"
|
||||||
|
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
|
||||||
|
-- $RESTORECOND_ARGS
|
||||||
|
status=$?
|
||||||
|
if [ "$status" -eq 0 ]; then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
fi
|
||||||
|
return "$status"
|
||||||
|
}
|
||||||
|
|
||||||
|
stop()
|
||||||
|
{
|
||||||
|
printf 'Stopping %s: ' "$DAEMON"
|
||||||
|
start-stop-daemon -K -q -p $PIDFILE -R TERM/30/KILL/5 -n $DAEMON
|
||||||
|
status=$?
|
||||||
|
if [ "$status" -eq 0 ]; then
|
||||||
|
rm -f "$PIDFILE"
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
fi
|
||||||
|
return "$status"
|
||||||
|
}
|
||||||
|
|
||||||
|
restart()
|
||||||
|
{
|
||||||
|
stop
|
||||||
|
sleep 1
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start|stop|restart)
|
||||||
|
"$1";;
|
||||||
|
reload)
|
||||||
|
restart;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop|restart|reload}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
@@ -27,8 +27,8 @@ define RESTORECOND_BUILD_CMDS
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define RESTORECOND_INSTALL_INIT_SYSV
|
define RESTORECOND_INSTALL_INIT_SYSV
|
||||||
$(INSTALL) -m 0755 -D $(@D)/restorecond.init \
|
$(INSTALL) -m 0755 -D package/restorecond/S02restorecond \
|
||||||
$(TARGET_DIR)/etc/init.d/S20restorecond
|
$(TARGET_DIR)/etc/init.d/S02restorecond
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define RESTORECOND_INSTALL_INIT_SYSTEMD
|
define RESTORECOND_INSTALL_INIT_SYSTEMD
|
||||||
|
|||||||
Reference in New Issue
Block a user