diff --git a/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf b/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf index 385f850a1b9d..60f430b686e7 100644 --- a/external/bsd/dhcpcd/dist/dhcpcd-hooks/20-resolv.conf +++ b/external/bsd/dhcpcd/dist/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/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf b/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf index e569cf1ed1df..b88553f0fe34 100644 --- a/external/bsd/dhcpcd/dist/dhcpcd-hooks/50-ntp.conf +++ b/external/bsd/dhcpcd/dist/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 diff --git a/external/bsd/dhcpcd/dist/dhcpcd.c b/external/bsd/dhcpcd/dist/dhcpcd.c index 52fc9b803528..358df647c544 100644 --- a/external/bsd/dhcpcd/dist/dhcpcd.c +++ b/external/bsd/dhcpcd/dist/dhcpcd.c @@ -1596,31 +1596,31 @@ main(int argc, char **argv) PACKAGE " will not work correctly unless run as root"); if (sig != 0) { - i = -1; pid = read_pid(); if (pid != 0) syslog(LOG_INFO, "sending signal %d to pid %d", sig, pid); - - if (!pid || (i = kill(pid, sig))) { + if (pid == 0 || kill(pid, sig) != 0) { if (sig != SIGALRM) syslog(LOG_ERR, ""PACKAGE" not running"); unlink(pidfile); + if (sig != SIGALRM) + exit(EXIT_FAILURE); + } else { + if (sig == SIGALRM) + exit(EXIT_SUCCESS); + /* Spin until it exits */ + syslog(LOG_INFO, "waiting for pid %d to exit", pid); + ts.tv_sec = 0; + ts.tv_nsec = 100000000; /* 10th of a second */ + for(i = 0; i < 100; i++) { + nanosleep(&ts, NULL); + if (read_pid() == 0) + exit(EXIT_SUCCESS); + } + syslog(LOG_ERR, "pid %d failed to exit", pid); exit(EXIT_FAILURE); } - if (sig == SIGALRM) - exit(EXIT_SUCCESS); - /* Spin until it exits */ - syslog(LOG_INFO, "waiting for pid %d to exit", pid); - ts.tv_sec = 0; - ts.tv_nsec = 100000000; /* 10th of a second */ - for(i = 0; i < 100; i++) { - nanosleep(&ts, NULL); - if (read_pid() == 0) - exit(EXIT_SUCCESS); - } - syslog(LOG_ERR, "pid %d failed to exit", pid); - exit(EXIT_FAILURE); } if (!(options & DHCPCD_TEST)) { diff --git a/external/bsd/dhcpcd/dist/dhcpcd.conf b/external/bsd/dhcpcd/dist/dhcpcd.conf index 78e55fcb73d6..98705f24e39e 100644 --- a/external/bsd/dhcpcd/dist/dhcpcd.conf +++ b/external/bsd/dhcpcd/dist/dhcpcd.conf @@ -13,3 +13,7 @@ option ntp_servers # However, a lot of buggy DHCP servers set invalid MTUs so this is not # enabled by default. #option interface_mtu + +# We provide a hook script to lookup the hostname if not set by the DHCP +# server, but we should not run it by default. +nohook lookup-hostname