# 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
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
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
}