aboutsummaryrefslogtreecommitdiffstats
path: root/dhcpcd-hooks/50-ntp.conf
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/50-ntp.conf
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/50-ntp.conf')
-rw-r--r--dhcpcd-hooks/50-ntp.conf17
1 files changed, 12 insertions, 5 deletions
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
}