From 938bc384f44031877543765a9ae18c764f5da9c8 Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Fri, 8 Jan 2010 10:47:26 -0800 Subject: dhcpcd: Upgrade from 4.0.1 to 4.0.15 Signed-off-by: Dmitry Shmidt --- dhcpcd-hooks/50-ntp.conf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'dhcpcd-hooks/50-ntp.conf') 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 } -- cgit v1.1