From: Roy Marples Date: Sun, 3 May 2009 20:07:14 +0000 (+0000) Subject: Ensure that our dirs exist in the PREINIT stage. X-Git-Tag: v5.0.2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c1a2aeefb0c0600fbb27fd6d79f180753e09188;p=thirdparty%2Fdhcpcd.git Ensure that our dirs exist in the PREINIT stage. Recent rc.d init scripts echo to stderr if not set to start, so remove warnings. --- diff --git a/dhcpcd-hooks/20-resolv.conf b/dhcpcd-hooks/20-resolv.conf index 385f850a..60f430b6 100644 --- a/dhcpcd-hooks/20-resolv.conf +++ b/dhcpcd-hooks/20-resolv.conf @@ -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 } diff --git a/dhcpcd-hooks/50-ntp.conf b/dhcpcd-hooks/50-ntp.conf index e569cf1e..b88553f0 100644 --- a/dhcpcd-hooks/50-ntp.conf +++ b/dhcpcd-hooks/50-ntp.conf @@ -11,11 +11,11 @@ # 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