summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Pryor <profjim@jimpryor.net>2009-09-14 05:43:42 +0200
committerJames Rayner <james@archlinux.org>2009-09-14 08:25:14 +0200
commitae4adf79c86e1c77192dc0022ead9b46214418fe (patch)
tree6229228b6bb1115909765b097cba5364832a2a50
parent06f6fab07786329be1d4b03a09c5af177cadd609 (diff)
downloadnetctl-ae4adf79c86e1c77192dc0022ead9b46214418fe.tar.gz
netctl-ae4adf79c86e1c77192dc0022ead9b46214418fe.tar.xz
load hooks only from /usr/lib/network/hooks
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
-rwxr-xr-xcontrib/logging.hook2
-rw-r--r--src/globals14
2 files changed, 5 insertions, 11 deletions
diff --git a/contrib/logging.hook b/contrib/logging.hook
index bf6b787..163bbfa 100755
--- a/contrib/logging.hook
+++ b/contrib/logging.hook
@@ -1,5 +1,5 @@
### Sample netcfg hook script for logging/debugging connections
-### To install, make this executable and put it in /etc/network.d/hooks
+### To install, make this executable and put it in /usr/lib/network/hooks
. /etc/rc.conf
diff --git a/src/globals b/src/globals
index 126095a..2d5cf19 100644
--- a/src/globals
+++ b/src/globals
@@ -1,6 +1,6 @@
# /usr/lib/networks/globals
#
-# any +x files in /usr/lib/network/hooks and /etc/network.d/hooks
+# any +x files in /usr/lib/network/hooks
# will be sourced when this file is.
# hook files can override any of the utility functions defined here for custom behavior
# (such as logging error messages to syslog)
@@ -10,10 +10,9 @@
### Globals
PROFILE_DIR="/etc/network.d/"
-HOOKS_DIR="/usr/lib/network/hooks/"
-USERHOOKS_DIR="$PROFILE_DIR/hooks/"
IFACE_DIR="$PROFILE_DIR/interfaces/"
SUBR_DIR="/usr/lib/network/"
+HOOKS_DIR="${SUBR_DIR}/hooks/"
CONN_DIR="${SUBR_DIR}/connections/"
STATE_DIR="/var/run/network/"
@@ -109,13 +108,8 @@ checkyesno()
function load_hooks() {
### Load any +x files in $HOOKS_DIR and $USERHOOKS_DIR
local hook
- for hook in $(find -L "$HOOKS_DIR/" "$USERHOOKS_DIR/$hook" -maxdepth 1 -type f -executable -printf '%P\n' | sort -u); do
- # if there's an executable hook of this name in USERHOOKS_DIR, we only load it
- if [ -x "$USERHOOKS_DIR/$hook" ]; then
- source "$USERHOOKS_DIR/$hook"
- else
- source "$HOOKS_DIR/$hook"
- fi
+ for hook in $(find -L "$HOOKS_DIR/" -maxdepth 1 -type f -executable | sort -u); do
+ source "$hook"
done
}