]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Detect OpenBSD rc system (check instead of status).
authorRoy Marples <roy@marples.name>
Fri, 7 Mar 2014 14:29:52 +0000 (14:29 +0000)
committerRoy Marples <roy@marples.name>
Fri, 7 Mar 2014 14:29:52 +0000 (14:29 +0000)
If ntpd.conf exists but ntp.conf does not, configure ntpd.conf instead.

dhcpcd-hooks/50-ntp.conf
dhcpcd-run-hooks.in

index c078136096181de84b630d37283bc5e33748adc4..4b1284cc8ff078dd8a8ce18201f1e115925b7694 100644 (file)
@@ -6,7 +6,7 @@
 #   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.
+# to use OpenNTPD instead of the default NTP.
 
 if type invoke-rc.d >/dev/null 2>&1; then
        # Debian has a seperate file for DHCP config to avoid stamping on
@@ -19,7 +19,16 @@ 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}
+
+# If we have installed OpenNTPD but not NTP then prefer it
+# XXX If both exist then update both?
+if [ -z "$NTP_CONF" -a -e /etc/ntpd.conf -a ! -e /etc/ntp.conf ]; then
+       : ${NTP_CONF:=/etc/ntpd.conf}
+else
+       : ${NTP_CONF:=/etc/ntp.conf}
+fi
+
+ntp_conf=${NTP_CONF}
 NL="
 "
 
index ccefc1b6941771d0b4f41138ff8459eee5ab7dae..365becf546d06c93af9ad1035fc48df60767ada0 100644 (file)
@@ -264,6 +264,8 @@ detect_init()
                done
                if [ -e /etc/arch-release ]; then
                        _service_status="[ -e /var/run/daemons/\$1 ]"
+               elif [ "$x" = "/etc/rc.d" -a -e /etc/rc.d/rc.subr ]; then
+                       _service_status="$x/\$1 check 1>/dev/null 2>&1"
                fi
        fi