xref: /OK3568_Linux_fs/buildroot/package/polkit/S50polkit (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2
3DAEMON="polkitd"
4DAEMON_PATH="/usr/lib/polkit-1/${DAEMON}"
5PIDFILE="/var/run/${DAEMON}.pid"
6POLKITD_ARGS="--no-debug"
7
8# polkitd does not create a pidfile, so pass "-n" in the command line
9# and use "-m" to instruct start-stop-daemon to create one.
10start() {
11	printf 'Starting %s: ' "${DAEMON}"
12	# shellcheck disable=SC2086 # we need the word splitting
13	start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${POLKITD_ARGS}
14	status=$?
15	if [ "$status" -eq 0 ]; then
16		echo "OK"
17	else
18		echo "FAIL"
19	fi
20	return "$status"
21}
22
23stop() {
24	printf 'Stopping %s: ' "${DAEMON}"
25	start-stop-daemon -Kqp "$PIDFILE"
26	status=$?
27	if [ "$status" -eq 0 ]; then
28		rm -f "$PIDFILE"
29		echo "OK"
30	else
31		echo "FAIL"
32	fi
33	return "$status"
34}
35
36restart() {
37	stop
38	sleep 1
39	start
40}
41
42case "$1" in
43	start|stop|restart|reload)
44		"$1";;
45	reload)
46		# Restart, since there is no true "reload" feature.
47		restart;;
48	*)
49		echo "Usage: $0 {start|stop|restart|reload}"
50		exit 1
51esac
52