--- /dev/null
+# Compat enter hook shim for older dhcpcd versions
+
+IPADDR=${new_ip_address}
+INTERFACE=${interface}
+NETMASK=${new_subnet_mask}
+BROADCAST=${new_broadcast_address}
+NETWORK=${new_network_address}
+DHCPSID=${new_dhcp_server_identifier}
+GATEWAYS=${new_routers}
+DNSSERVERS=${new_domain_name_servers}
+DNSDOMAIN=${new_domain_name}
+DNSSEARCH=${new_domain_search}
+NISDOMAIN=${new_nis_domain}
+NISSERVERS=${new_nis_servers}
+NTPSERVERS=${new_ntp_servers}
+
+GATEWAY=
+for x in ${new_routers}; do
+ GATEWAY="${GATEWAY}${GATEWAY:+,}${x}"
+done
+DNS=
+for x in ${new_domain_name_servers}; do
+ DNS="${DNS}${DNS:+,}${x}"
+done
+
+x="down"
+case "${reason}" in
+ RENEW) x="up";;
+ BOUND|INFORM|REBIND|REBOOT|TEST|TIMEOUT|IPV4LL) x="new";;
+esac
+set -- "" "${x}"
--- /dev/null
+#!/bin/sh
+# Sample exit hook script for ntp
+
+# 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 restart"
+elif [ -x /etc/rc.d/ntpd ]; then
+ ntpd_restart_cmd="/etc/rc.d/ntpd restart"
+elif [ -x /usr/local/etc/rc.d/ntpd ]; then
+ ntpd_restart_cmd="/usr/local/etc/rc.d/ntpd restart"
+fi
+
+make_ntp_conf()
+{
+ [ -z "${new_ntp_servers}" ] && return 0
+ local cf=/etc/ntp.conf."${interface}" x=
+ echo "${signature}" > "${cf}"
+ echo "restrict default noquery notrust nomodify" >> "${cf}"
+ echo "restrict 127.0.0.1" >> "${cf}"
+ for x in ${new_ntp_servers}; do
+ echo "restrict ${x} nomodify notrap noquery" >> "${cf}"
+ echo "server ${x}" >> "${cf}"
+ done
+ if [ ! -e /etc/ntp.conf ]; then
+ true
+ elif type cmp >/dev/null 2>&1; then
+ cmp -s /etc/ntp.conf "${cf}"
+ elif type diff >/dev/null 2>&1; then
+ diff -q /etc/ntp.conf "${cf}" >/dev/null
+ else
+ false
+ fi
+ if [ $? = 0 ]; then
+ rm -f "${cf}"
+ else
+ save_conf /etc/ntp.conf
+ mv -f "${cf}" /etc/ntp.conf
+ [ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
+ fi
+}
+
+restore_ntp_conf()
+{
+ restore_conf /etc/ntp.conf || return 0
+ [ -n "${ntpd_restart_cmd}" ] && ${ntpd_restart_cmd}
+}
+
+case "${reason}" in
+ TEST)
+ # non op
+ ;;
+ BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)
+ make_ntp_conf
+ ;;
+ EXPIRE|FAIL|IPV4LL|RELEASE|STOP)
+ restore_ntp_conf
+ ;;
+ *)
+ echo "ntp: unsupported reason ${reason}" >&2
+ false
+ ;;
+esac
--- /dev/null
+#!/bin/sh
+# Sample exit hook for ypbind
+# This script is only suitable for the Linux version.
+
+ypbind_pid()
+{
+ [ -s /var/run/ypbind.pid ] && cat /var/run/ypbind.pid
+}
+
+make_yp_conf()
+{
+ [ -z "${new_nis_domain}" -a -z "${new_nis_servers}" ] && return 0
+ local cf=/etc/yp.conf."${interface}" prefix= x= pid=
+ echo "${signature}" > "${cf}"
+ if [ -n "${new_nis_domain}" ]; then
+ domainname "${new_nis_domain}"
+ if [ -n "${new_nis_server}" ]; then
+ prefix="domain ${new_nis_domain} server "
+ else
+ echo "domain ${new_nis_domain} broadcast" >> "${cf}"
+ fi
+ else
+ prefix="ypserver "
+ fi
+ for x in ${new_nis_servers}; do
+ echo "${prefix}${x}" >> "${cf}"
+ done
+ save_conf /etc/yp.conf
+ mv -f "${cf}" /etc/yp.conf
+ pid="$(ypbind_pid)"
+ if [ -n "${pid}" ]; then
+ kill -HUP "${pid}"
+ fi
+}
+
+restore_yp_conf()
+{
+ [ -n "${old_nis_domain}" ] && domainname ""
+ restore_conf /etc/yp.conf || return 0
+ local pid="$(ypbind_pid)"
+ if [ -n "${pid}" ]; then
+ kill -HUP "${pid}"
+ fi
+}
+
+case "${reason}" in
+ TEST)
+ # non op
+ true
+ ;;
+ BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)
+ make_yp_conf
+ ;;
+ EXPIRE|FAIL|IPV4LL|RELEASE|STOP)
+ restore_yp_conf
+ ;;
+ *)
+ echo "ypbind: unsupported reason ${reason}" >&2
+ false
+ ;;
+esac