summaryrefslogtreecommitdiff
path: root/sys-apps/restorecond/files/restorecond.init
blob: 709f1d1b9ecee09b1bdcbc4cf8a2c6e9cde3dad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/sbin/openrc-run
# Copyright 2006-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

is_selinux_enabled() {
	local SE_ENABL="/usr/sbin/selinuxenabled"

	if [ -x "$SE_ENABL" ]; then
		$SE_ENABL && return 0 || return 1
	else
		ewarn "Restorecond: Unable to determine SELinux status"
		return 1
	fi
}

start() {
	if is_selinux_enabled; then
		ebegin "Starting restorecond"
		start-stop-daemon --start --quiet --exec /usr/sbin/restorecond
		eend $?
	fi
}

stop() {
	if is_selinux_enabled; then
		ebegin "Stopping restorecond"
		start-stop-daemon --stop --quiet --pidfile /var/run/restorecond.pid
		eend $?
	fi
}