aboutsummaryrefslogtreecommitdiffstats
path: root/dhcpcd-hooks
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2010-01-08 10:47:26 -0800
committerDmitry Shmidt <dimitrysh@google.com>2010-01-08 10:47:26 -0800
commit938bc384f44031877543765a9ae18c764f5da9c8 (patch)
tree3c5d3e2749b7b1bef613a1283373d61945db7421 /dhcpcd-hooks
parentb22386a3de85d94030c7071760f4a5e3368bfbe5 (diff)
downloadexternal_dhcpcd-938bc384f44031877543765a9ae18c764f5da9c8.zip
external_dhcpcd-938bc384f44031877543765a9ae18c764f5da9c8.tar.gz
external_dhcpcd-938bc384f44031877543765a9ae18c764f5da9c8.tar.bz2
dhcpcd: Upgrade from 4.0.1 to 4.0.15
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'dhcpcd-hooks')
-rw-r--r--dhcpcd-hooks/01-test7
-rw-r--r--dhcpcd-hooks/50-dhcpcd-compat12
-rw-r--r--dhcpcd-hooks/50-ntp.conf17
3 files changed, 26 insertions, 10 deletions
diff --git a/dhcpcd-hooks/01-test b/dhcpcd-hooks/01-test
index 609b3a1..ef7896d 100644
--- a/dhcpcd-hooks/01-test
+++ b/dhcpcd-hooks/01-test
@@ -1,7 +1,6 @@
# Just echo our DHCP options we have
-case ${reason} in
-TEST) set | grep "^\(interface\|metric\|pid\|reason\|skip_hooks\)=" | sort
+if [ "${reason}" = "TEST" ]; then
+ set | grep "^\(interface\|metric\|pid\|reason\|skip_hooks\)=" | sort
set | grep "^\(new_\|old_\)" | sort
- ;;
-esac
+fi
diff --git a/dhcpcd-hooks/50-dhcpcd-compat b/dhcpcd-hooks/50-dhcpcd-compat
index cba40a4..bb31fd3 100644
--- a/dhcpcd-hooks/50-dhcpcd-compat
+++ b/dhcpcd-hooks/50-dhcpcd-compat
@@ -28,4 +28,14 @@ case "${reason}" in
RENEW) x="up";;
BOUND|INFORM|REBIND|REBOOT|TEST|TIMEOUT|IPV4LL) x="new";;
esac
-set -- "" "${x}"
+
+if [ "${reason}" != "down" ]; then
+ rm -f /var/lib/dhcpcd-"${INTERFACE}".info
+ for x in IPADDR INTERFACE NETMASK BROADCAST NETWORK DHCPSID GATEWAYS \
+ DNSSERVERS DNSDOMAIN DNSSEARCH NISDOMAIN NISSERVERS \
+ NTPSERVERS GATEWAY DNS; do
+ eval echo "${x}=\'\$${x}\'" >> /var/lib/dhcpcd-"${INTERFACE}".info
+ done
+fi
+
+set -- /var/lib/dhcpcd-"${INTERFACE}".info "${x}"
diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf
index 536f14e..8c92f27 100644
--- a/dhcpcd-hooks/50-ntp.conf
+++ b/dhcpcd-hooks/50-ntp.conf
@@ -2,21 +2,28 @@
# Like our resolv.conf hook script, we store a database of ntp.conf files
# and merge into /etc/ntp.conf
+# You can set the env var NTP_CONF to another file like this
+# dhcpcd -e NTP_CONF=/usr/pkg/etc/ntpd.conf
+# or by adding this to /etc/dhcpcd.enter-hook
+# NTP_CONF=/usr/pkg/etc/ntpd.conf
+# to use openntpd from pkgsrc instead of the system provided ntp.
+
# Detect OpenRC or BSD rc
# Distributions may want to just have their command here instead of this
if type rc-service >/dev/null 2>&1 && rc-service --exists ntpd; then
ntpd_restart_cmd="rc-service ntpd -- --ifstarted --quiet restart"
elif [ -x /etc/rc.d/ntpd ]; then
- ntpd_restart_cmd="/etc/rc.d/ntpd restart"
+ ntpd_restart_cmd="/etc/rc.d/ntpd status && /etc/rc.d/ntpd restart"
elif [ -x /usr/local/etc/rc.d/ntpd ]; then
- ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd restart"
+ ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status && /usr/local/etc/rc.d/ntpd restart"
fi
ntp_conf_dir="${state_dir}/ntp.conf"
+ntp_conf=${NTP_CONF:-/etc/ntp.conf}
build_ntp_conf()
{
- local cf="/etc/ntp.conf.${interface}"
+ local cf="${ntp_conf}.${interface}"
local interfaces= header= srvs= servers= x=
# Build a list of interfaces
@@ -49,8 +56,8 @@ build_ntp_conf()
fi
# If we changed anything, restart ntpd
- if change_file /etc/ntp.conf "${cf}"; then
- [ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
+ if change_file "${ntp_conf}" "${cf}"; then
+ [ -n "${ntpd_restart_cmd}" ] && eval ${ntpd_restart_cmd}
fi
}