Package: policycoreutils Version: 2.0.55-1 Severity: wishlist Tags: patch User: pet...@debian.org Usertags: initd-status-support
Here is a patch to support the "status" action in the init.d script. Note that I wanted to make "status" usable even as non-root user, so I had to rejuggle a few things. Also note that the dependency on lsb-base is already missing in the current version.
diff -u policycoreutils-2.0.55/restorecond/restorecond.init policycoreutils-2.0.55/restorecond/restorecond.init --- policycoreutils-2.0.55/restorecond/restorecond.init +++ policycoreutils-2.0.55/restorecond/restorecond.init @@ -30,7 +30,9 @@ [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled || exit 0 # Check that we are root ... so non-root users stop here -test $(id -u) = 0 || exit 1 +if [ $(id -u) != 0 ] && [ "$1" != status ]; then + exit 4 +fi # Get lsb functions @@ -38,7 +40,7 @@ # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Test to see if we are configured -if [ ! -f /etc/selinux/restorecond.conf ]; then +if [ ! -f /etc/selinux/restorecond.conf ] && [ "$1" != status ]; then log_failure_msg "There is no configuration file for restorecond." log_failure_msg "Please create /etc/selinux/restorecond.conf." exit 6 @@ -70,8 +72,12 @@ $0 start || RETVAL=1 log_action_end_msg $RETVAL ;; + status) + status_of_proc /usr/sbin/restorecond restorecond + exit $? + ;; *) - log_success_msg "Usage: $0 {start|stop|restart|reload|condrestart}" + log_success_msg "Usage: $0 {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac diff -u policycoreutils-2.0.55/debian/control policycoreutils-2.0.55/debian/control --- policycoreutils-2.0.55/debian/control +++ policycoreutils-2.0.55/debian/control @@ -12,7 +12,7 @@ Package: policycoreutils Architecture: any -Depends: ${shlibs:Depends}, python (>= 2.5), python-semanage, +Depends: ${shlibs:Depends}, lsb-base (>= 3.2-13), python (>= 2.5), python-semanage, python-selinux, python-sepolgen (>=1.0.11-4) Recommends: selinux-policy-default Description: SELinux core policy utilities