]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Correctly restart ntp on Debian.
authorRoy Marples <roy@marples.name>
Tue, 14 Jun 2011 08:37:06 +0000 (08:37 +0000)
committerRoy Marples <roy@marples.name>
Tue, 14 Jun 2011 08:37:06 +0000 (08:37 +0000)
dhcpcd-hooks/50-ntp.conf

index aeb02688528f3c4ac72d68ffdc084bc5f62dd031..83e71bf03583ea62a31da0d547cdaae6b5e7d356 100644 (file)
@@ -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
 }