From: Roy Marples Date: Mon, 27 Oct 2008 12:41:04 +0000 (+0000) Subject: Allow ntp.conf location to be tunable, #119 X-Git-Tag: v4.0.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7f7888ffcb07dc19443be08bde7ba5518ae16e7;p=thirdparty%2Fdhcpcd.git Allow ntp.conf location to be tunable, #119 --- diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index 536f14e9..d4062589 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -2,6 +2,12 @@ # 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 @@ -13,10 +19,11 @@ elif [ -x /usr/local/etc/rc.d/ntpd ]; then 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,7 +56,7 @@ build_ntp_conf() fi # If we changed anything, restart ntpd - if change_file /etc/ntp.conf "${cf}"; then + if change_file "${ntp_conf}" "${cf}"; then [ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd} fi }