Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
policycoreutils
policycoreutils-initscript.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File policycoreutils-initscript.patch of Package policycoreutils
Index: restorecond/restorecond.init =================================================================== --- restorecond/restorecond.init.orig +++ restorecond/restorecond.init @@ -1,14 +1,23 @@ #!/bin/sh # -# restorecond: Daemon used to maintain path file context +# /etc/init.d/restorecond # -# chkconfig: - 12 87 -# description: restorecond uses inotify to look for creation of new files \ -# listed in the /etc/selinux/restorecond.conf file, and restores the \ -# correct security context. +### BEGIN INIT INFO +# Provides: restorecond +# Required-Start: $remote_fs +# Should-Start: +# Required-Stop: $remote_fs +# Should-Stop: +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Daemon used to maintain path file context +# Description: Restorecond uses inotify to look for creation of new files +# listed in the /etc/selinux/restorecond.conf file, and restores the correct +# security context. +### END INIT INFO # # processname: /usr/sbin/restorecond -# config: /etc/selinux/restorecond.conf +# config: /etc/selinux/restorecond.conf # pidfile: /var/run/restorecond.pid # # Return values according to LSB for all commands but status: @@ -22,42 +31,61 @@ # 7 - program is not running PATH=/sbin:/bin:/usr/bin:/usr/sbin +PROG_BIN=/usr/sbin/restorecond +LOCK_FILE=/var/lock/subsys/restorecond +PROG_CONF=/etc/selinux/restorecond.conf # Source function library. -. /etc/rc.d/init.d/functions +. /etc/rc.status -[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || exit 0 +# Check whether SELinux is enabled +if [ ! -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled ; then + echo $"SELinux should be enabled to run this daemon" + rc_failed 1 + rc_status -v + rc_exit +fi # Check that we are root ... so non-root users stop here -test $EUID = 0 || exit 4 +if [ $EUID -ne 0 ] ; then + echo $"Access denied. Only root can run this daemon" + rc_failed 4 + rc_status -v + rc_exit +fi + +# Check whether program binary exists +if [ ! -x $PROG_BIN ] ; then + echo $"$PROG_BIN does not exist or has no executable permission" + rc_failed 5 + rc_status -v + rc_exit +fi + +# Check whether the required conf file exists +if [ ! -f $PROG_CONF ] ; then + echo $"$PROG_CONF not found" + rc_failed 6 + rc_status -v + rc_exit +fi -test -x /usr/sbin/restorecond || exit 5 -test -f /etc/selinux/restorecond.conf || exit 6 - -RETVAL=0 - -start() +start() { - echo -n $"Starting restorecond: " - unset HOME MAIL USER USERNAME - daemon /usr/sbin/restorecond - RETVAL=$? - touch /var/lock/subsys/restorecond - echo - return $RETVAL + echo -n $"Starting restorecond: " + unset HOME MAIL USER USERNAME + startproc -p $LOCK_FILE $PROG_BIN + rc_status -v } -stop() +stop() { - echo -n $"Shutting down restorecond: " - killproc restorecond - RETVAL=$? - rm -f /var/lock/subsys/restorecond - echo - return $RETVAL + echo -n $"Shutting down restorecond: " + killproc -p $LOCK_FILE -TERM $PROG_BIN + rc_status -v } -restart() +restart() { stop start @@ -72,18 +100,20 @@ case "$1" in stop ;; status) - status restorecond - RETVAL=$? + echo -n $"Checking for restorecond: " + checkproc -p $LOCK_FILE $PROG_BIN + rc_status -v ;; force-reload|restart|reload) restart ;; condrestart) - [ -e /var/lock/subsys/restorecond ] && restart || : + [ -e $LOCK_FILE ] && restart || : ;; *) echo $"Usage: $0 {start|stop|restart|force-reload|status|condrestart}" - RETVAL=3 + rc_failed 3 + rc_status -v esac -exit $RETVAL +rc_exit
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor