NetBSD/dist/dhcpcd/dhcpcd-run-hooks.in
joerg 8eeb8277e5 Import dhcpcd 4.0.0-beta5.
dhcpcd is a small DHCP client, supporting most, if not all, features of
dhclient.  It is much smaller (1/6 of the size on amd64), but still
supports many of the more advanced modern RFCs like IPv4LL (RFC 3927),
Classless Static Routes (RFC 3442) and Node-specific Client Identifiers
(RFC 4361).  It was written by Roy Marpled, partly in reply to the
discussion of the DHCP client Sommer of Code project.
2008-05-24 19:37:41 +00:00

39 lines
935 B
Bash

#!/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