| Index: dhcpcd-hooks/50-ntp.conf
|
| diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf
|
| deleted file mode 100644
|
| index 8fad6df55b334ded07539380d1d4f20940cbd354..0000000000000000000000000000000000000000
|
| --- a/dhcpcd-hooks/50-ntp.conf
|
| +++ /dev/null
|
| @@ -1,92 +0,0 @@
|
| -# Sample dhcpcd hook script for ntp
|
| -# 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 -- -Ds restart"
|
| -elif [ -x /etc/rc.d/ntpd ]; then
|
| - ntpd_restart_cmd="/etc/rc.d/ntpd status >/dev/null 2>&1 && /etc/rc.d/ntpd restart"
|
| -elif [ -x /usr/local/etc/rc.d/ntpd ]; then
|
| - ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd status >/dev/null 2>&1 && /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="$state_dir/ntp.conf.$interface"
|
| - local interfaces= header= srvs= servers= x=
|
| -
|
| - # Build a list of interfaces
|
| - interfaces=$(list_interfaces "$ntp_conf_dir")
|
| -
|
| - if [ -n "$interfaces" ]; then
|
| - # Build the header
|
| - for x in ${interfaces}; do
|
| - header="$header${header:+, }$x"
|
| - done
|
| -
|
| - # Build a server list
|
| - srvs=$(cd "$ntp_conf_dir";
|
| - key_get_value "server " $interfaces)
|
| - if [ -n "$srvs" ]; then
|
| - for x in $(uniqify $srvs); do
|
| - servers="${servers}server $x\n"
|
| - done
|
| - fi
|
| - fi
|
| -
|
| - # Merge our config into ntp.conf
|
| - [ -e "$cf" ] && rm -f "$cf"
|
| - [ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
|
| - if [ -e "$ntp_conf" ]; then
|
| - remove_markers "$signature_base" "$signature_base_end" \
|
| - "$ntp_conf" > "$cf"
|
| - fi
|
| - if [ -n "$servers" ]; then
|
| - echo "$signature_base${header:+ $from }$header" >> "$cf"
|
| - printf "$search$servers" >> "$cf"
|
| - echo "$signature_base_end${header:+ $from }$header" >> "$cf"
|
| - fi
|
| -
|
| - # If we changed anything, restart ntpd
|
| - if change_file "$ntp_conf" "$cf"; then
|
| - [ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd
|
| - fi
|
| -}
|
| -
|
| -add_ntp_conf()
|
| -{
|
| - local cf="$ntp_conf_dir/$interface" x=
|
| -
|
| - [ -e "$cf" ] && rm "$cf"
|
| - [ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
|
| - if [ -n "$new_ntp_servers" ]; then
|
| - for x in $new_ntp_servers; do
|
| - echo "server $x" >> "$cf"
|
| - done
|
| - fi
|
| - build_ntp_conf
|
| -}
|
| -
|
| -remove_ntp_conf()
|
| -{
|
| - if [ -e "$ntp_conf_dir/$interface" ]; then
|
| - rm "$ntp_conf_dir/$interface"
|
| - fi
|
| - build_ntp_conf
|
| -}
|
| -
|
| -case "$reason" in
|
| -BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) add_ntp_conf add;;
|
| -PREINIT|EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP) remove_ntp_conf del;;
|
| -esac
|
|
|