diff options
| author | Roy Marples <roy@marples.name> | 2008-05-24 17:15:14 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-05-24 17:15:14 +0000 |
| commit | ee4e620abbd8cf362c36047bea040c692bd9f282 (patch) | |
| tree | b2543714dc22ad0678a437d1e409404a2a506485 /dhcpcd-run-hooks.in | |
| parent | 759f2a055abd3b4b705bdb942128c9772697b6f8 (diff) | |
| download | dhcpcd-ee4e620abbd8cf362c36047bea040c692bd9f282.tar.xz | |
Move dhcpcd.sh to dhcpcd-run-hooks and remove .sh suffixes
Diffstat (limited to 'dhcpcd-run-hooks.in')
| -rw-r--r-- | dhcpcd-run-hooks.in | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dhcpcd-run-hooks.in b/dhcpcd-run-hooks.in new file mode 100644 index 00000000..7fd8b091 --- /dev/null +++ b/dhcpcd-run-hooks.in @@ -0,0 +1,38 @@ +#!/bin/sh +# dhcpcd client configuration script + +# Handy functions for our hooks to use +signature="# Generated by dhcpcd for ${interface}" +save_conf() +{ + if [ -f "$1" ]; then + rm -f "$1"-pre."${interface}" + mv -f "$1" "$1"-pre."${interface}" + fi +} +restore_conf() +{ + [ -f "$1"-pre."${interface}" ] || return 1 + rm -f "$1" + mv -f "$1"-pre."${interface}" "$1" +} + +# We source each script into this one so that scripts run earlier can +# remove variables from the environment so later scripts don't see them. +# Thus, the user can create their dhcpcd.hook script to configure +# /etc/resolv.conf how they want and stop the system scripts ever updating it. +for hook in \ + @SYSCONFDIR@/dhcpcd.hook \ + @HOOKDIR@/* +do + for skip in ${skip_hooks}; do + case "${hook}" in + "${skip}") continue 2;; + */[0-9][0-9]"-${skip}") continue 2;; + */[0-9][0-9]"-${skip}.sh") continue 2;; + esac + done + if [ -f "${hook}" ]; then + . "${hook}" + fi +done |
