#!/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 <mika@grml.org>
# 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
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 #################################################################