Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 643c8c8f9b3e3b8125a3028f52cd05a8 > files > 3

smack-util-0.1-2mdv2009.0.src.rpm

#! /bin/bash
#
#	/etc/init.d/smack
#
# Starts smack rules
#
# chkcondig: 345 01 99
# description: SMACK rc files. This rc script configures \
#              SMACK based on the local config files.
#
### BEGIN INIT INFO
# Provides: smack
# Required-Start:
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: SMACK initialization
# Description: SMACK rc files. This rc script configures \
#              SMACK based on the local config files.
### END INIT INFO

# source function library
. /etc/init.d/functions

# 
# Set a bunch of things to have star labels.
#
# TODO: Check error codes

smack_start()
{
	gprintf "Starting SMACK: "

	mount -t smackfs smackfs /smack -osmackfsdef=*

	if [ -f /etc/smack/accesses ] ; then
		/usr/sbin/smackload < /etc/smack/accesses
	fi
	
	if [ -f /etc/smack/cipso ] ; then
		/usr/sbin/smackcipso < /etc/smack/cipso
	fi
	
	if [ -f /etc/smack/ambient ] ; then
		cat /etc/smack/ambient > /smack/ambient
	fi
	
	if [ -f /etc/smack/nltype ] ; then
		cat /etc/smack/nltype > /smack/nltype
	fi

	success "startup"
	echo
}

smack_stop()
{
	umount /smack
}

rc=0

case "$1" in
	start)
		smack_start
		rc=$?
		;;
	stop)
		smack_stop
		rc=$?
		;;
	restart)
		smack_stop
		smack_start
		rc=$?
		;;
	esac
exit $rc