]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure that our dirs exist in the PREINIT stage.
authorRoy Marples <roy@marples.name>
Sun, 3 May 2009 20:07:14 +0000 (20:07 +0000)
committerRoy Marples <roy@marples.name>
Sun, 3 May 2009 20:07:14 +0000 (20:07 +0000)
Recent rc.d init scripts echo to stderr if not set to start, so remove
warnings.

dhcpcd-hooks/20-resolv.conf
dhcpcd-hooks/50-ntp.conf

index 385f850a1b9da11f3427513a2aaee5595da4b066..60f430b686e779aaa2a34412a08690e9ade946b8 100644 (file)
@@ -48,6 +48,7 @@ build_resolv_conf()
 
        # Assemble resolv.conf using our head and tail files
        [ -f "$cf" ] && rm -f "$cf"
+       [ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
        echo "$header" > "$cf"
        if [ -f /etc/resolv.conf.head ]; then
                cat /etc/resolv.conf.head >> "$cf"
@@ -101,9 +102,7 @@ add_resolv_conf()
        if [ -e "$resolv_conf_dir/$interface" ]; then
                rm -f "$resolv_conf_dir/$interface"
        fi
-       if [ ! -d "$resolv_conf_dir" ]; then
-               mkdir -p "$resolv_conf_dir"
-       fi
+       [ -d "$resolv_conf_dir" ] || mkdir -p "$resolv_conf_dir"
        printf "$conf" > "$resolv_conf_dir/$interface"
        build_resolv_conf
 }
index e569cf1ed1dfcbcdaa78e0dd8ce35b9920b0bbc8..b88553f0fe34851cbd0fb075fc37bf4dd26eb7b8 100644 (file)
 # 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 -- --ifstarted --quiet restart"
+       ntpd_restart_cmd="rc-service ntpd -- -Ds restart"
 elif [ -x /etc/rc.d/ntpd ]; then
-       ntpd_restart_cmd="/etc/rc.d/ntpd status && /etc/rc.d/ntpd restart"
+       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 && /usr/local/etc/rc.d/ntpd restart"
+       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"
@@ -47,6 +47,7 @@ build_ntp_conf()
 
        # Merge our config into ntp.conf
        [ -e "$cf" ] && rm -f "$cf"
+       [ -d "$ntp_conf_dir" ] || mkdir -p "$ntp_conf_dir"
        remove_markers "$signature_base" "$signature_base_end" \
                "$ntp_conf" > "$cf"
        if [ -n "$servers" ]; then