#!/sbin/runscript
# Copyright 2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-projects/hardened/policycoreutils-extra/scripts/restorecond,v 1.1 2006/10/04 23:19:09 pebenito Exp $

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

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

start() {
	if is_selinux_enabled; then
		ebegin "Starting mcstransd"
		mkdir -p /var/run/setrans && chcon -t setrans_var_run_t /var/run/setrans;
		start-stop-daemon --start --quiet --exec /sbin/mcstransd
		eend $?
	fi
}

stop() {
	if is_selinux_enabled; then
		ebegin "Stopping mcstransd"
		start-stop-daemon --stop --quiet --name mcstransd
		eend $?
	fi
}
