X-Git-Url: http://git.grml.org/?a=blobdiff_plain;ds=sidebyside;f=policy-rc.d;fp=grml-policy-rc.d;h=3964dc57a1d954400800a75e11bce862c64a00cd;hb=d7dd305e129fde8366289aa752583706bb8a6ad1;hp=9e4340f1b81938feb25cae9cd6e7cb16833b4f8f;hpb=9ee46dd87c356e6b6b186f1cfa9ef9ef71a4b052;p=grml-policyrcd.git diff --git a/grml-policy-rc.d b/policy-rc.d similarity index 50% rename from grml-policy-rc.d rename to policy-rc.d index 9e4340f..3964dc5 100755 --- a/grml-policy-rc.d +++ b/policy-rc.d @@ -1,10 +1,9 @@ #!/bin/sh -# Filename: grml-policy-rc.d +# Filename: policy-rc.d # Purpose: interface script for invoke-rc.d (see /etc/policy-rc.d.conf) # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Mit Okt 18 20:43:22 UTC 2006 [mika] ################################################################################ # test for chroot @@ -14,15 +13,35 @@ if test "$(/usr/bin/stat -c "%d/%i" /)" != "$(/usr/bin/stat -Lc "%d/%i" /proc/1/ fi # read configuration file -if [ -r /etc/policy-rc.d.conf ] ; then - . /etc/policy-rc.d.conf +if [ -z "$POLICYRCD" ] ; then + if [ -r /etc/policy-rc.d.conf ] ; then + . /etc/policy-rc.d.conf + fi fi -if [ -n "$EXITSTATUS" ]; then - exit "$EXITSTATUS" +if [ -z "$POLICYRCD" ]; then + for file in /usr/local/sbin/policy-rc.d /etc/policy-rc.d; do + if [ -x "$file" ]; then + POLICYRCD="$file" + break + fi + done +fi + +# if $POLICYRCD is set or either /usr/local/sbin/policy-rc.d +# or /etc/policy-rc.d are present execute them: +if [ -n "$POLICYRCD" ]; then + $POLICYRCD "$@" + exit $? else - # allow it - exit 0 + # otherwise exit with $EXITSTATUS, + # being '0' by default + if [ -n "$EXITSTATUS" ]; then + exit "$EXITSTATUS" + else + # or if $EXITSTATUS isn't set just allow it + exit 0 + fi fi ## END OF FILE #################################################################