From: Roy Marples Date: Tue, 14 Jun 2011 08:37:06 +0000 (+0000) Subject: Correctly restart ntp on Debian. X-Git-Tag: v5.5.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e51462158e78bdb7f6a508581f2389b90193b0c8;p=thirdparty%2Fdhcpcd.git Correctly restart ntp on Debian. --- diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index aeb02688..83e71bf0 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -8,14 +8,16 @@ # NTP_CONF=/usr/pkg/etc/ntpd.conf # to use openntpd from pkgsrc instead of the system provided ntp. -: ${ntpd_restart_cmd:=service_condcommand ntpd restart} if type invoke-rc.d >/dev/null 2>&1; then # Debian has a seperate file for DHCP config to avoid stamping on # the master. [ -e /var/lib/ntp ] || mkdir /var/lib/ntp + : ${ntp_service:=ntp} : ${NTP_DHCP_CONF:=/var/lib/ntp/ntp.conf.dhcp} fi +: ${ntp_service:=ntpd} +: ${ntp_restart_cmd:=service_condcommand $ntp_service restart} ntp_conf_dir="$state_dir/ntp.conf" ntp_conf=${NTP_CONF:-/etc/ntp.conf} NL=" @@ -62,12 +64,12 @@ build_ntp_conf() printf %s "$servers" >> "$cf" echo "$signature_base_end${header:+ $from }$header" >> "$cf" else - [ -e "$ntp_conf" ] || return + [ -e "$ntp_conf" -a -e "$cf" ] || return fi # If we changed anything, restart ntpd if change_file "$ntp_conf" "$cf"; then - [ -n "$ntpd_restart_cmd" ] && eval $ntpd_restart_cmd + [ -n "$ntp_restart_cmd" ] && eval $ntp_restart_cmd fi }