summaryrefslogtreecommitdiff
path: root/patches/source/dhcpcd/50-ntp.conf.diff
blob: 63fd914b41173a9b0f46bcb20d245f90d7af54e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- ./dhcpcd-hooks/50-ntp.conf.orig	2010-11-19 04:17:14.000000000 -0600
+++ ./dhcpcd-hooks/50-ntp.conf	2010-12-29 16:07:48.000000000 -0600
@@ -8,6 +8,26 @@
 #   NTP_CONF=/usr/pkg/etc/ntpd.conf
 # to use openntpd from pkgsrc instead of the system provided ntp.
 
+# Detect OpenRC, Debian 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 type invoke-rc.d >/dev/null 2>&1; then
+        if [ -x /etc/init.d/ntp ]; then
+                ntpd_restart_cmd="invoke-rc.d ntp try-restart"
+        fi
+        # Debian as a seperate file for DHCP config to avoid stamping on
+        # the master.
+        [ -e /var/lib/ntp ] || mkdir /var/lib/ntp
+        : ${NTP_DHCP_CONF:=/var/lib/ntp/ntp.conf.dhcp}
+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"
+elif [ -x /etc/rc.d/rc.ntpd ]; then
+        ntpd_restart_cmd="/etc/rc.d/rc.ntpd status >/dev/null 2>&1 && /etc/rc.d/rc.ntpd restart"
+fi
+
 : ${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