diff options
Diffstat (limited to 'sh')
-rw-r--r-- | sh/.gitignore | 3 | ||||
-rw-r--r-- | sh/Makefile | 8 | ||||
-rw-r--r-- | sh/ifwatchd-carrier.sh.in | 5 | ||||
-rw-r--r-- | sh/ifwatchd-nocarrier.sh.in | 5 | ||||
-rw-r--r-- | sh/udhcpc-hook.sh.in | 117 |
5 files changed, 4 insertions, 134 deletions
diff --git a/sh/.gitignore b/sh/.gitignore index 9fe55105..386c42f6 100644 --- a/sh/.gitignore +++ b/sh/.gitignore @@ -6,9 +6,6 @@ runscript.sh cgroup-release-agent.sh init.sh init-early.sh -ifwatchd-carrier.sh -ifwatchd-nocarrier.sh rc-cgroup.sh -udhcpc-hook.sh tmpfiles.sh migrate-to-run.sh diff --git a/sh/Makefile b/sh/Makefile index 043b1448..7307f63a 100644 --- a/sh/Makefile +++ b/sh/Makefile @@ -13,12 +13,12 @@ SRCS-FreeBSD= BIN-FreeBSD= SRCS-Linux= cgroup-release-agent.sh.in init-early.sh.in migrate-to-run.sh.in \ - rc-cgroup.sh.in udhcpc-hook.sh.in + rc-cgroup.sh.in BIN-Linux= cgroup-release-agent.sh init-early.sh migrate-to-run.sh \ - rc-cgroup.sh udhcpc-hook.sh + rc-cgroup.sh -SRCS-NetBSD= ifwatchd-carrier.sh.in ifwatchd-nocarrier.sh.in -BIN-NetBSD= ifwatchd-carrier.sh ifwatchd-nocarrier.sh +SRCS-NetBSD= +BIN-NetBSD= include ${MK}/scripts.mk diff --git a/sh/ifwatchd-carrier.sh.in b/sh/ifwatchd-carrier.sh.in deleted file mode 100644 index 5b5d8b34..00000000 --- a/sh/ifwatchd-carrier.sh.in +++ /dev/null @@ -1,5 +0,0 @@ -#!@SHELL@ -# Wrapper for ifwatchd(8) - -IN_BACKGROUND=yes ; export IN_BACKGROUND -$RC_SERVICE --quiet start diff --git a/sh/ifwatchd-nocarrier.sh.in b/sh/ifwatchd-nocarrier.sh.in deleted file mode 100644 index bbecfe84..00000000 --- a/sh/ifwatchd-nocarrier.sh.in +++ /dev/null @@ -1,5 +0,0 @@ -#!@SHELL@ -# Wrapper for ifwatchd(8) - -IN_BACKGROUND=yes ; export IN_BACKGROUND -$RC_SERVICE --quiet stop diff --git a/sh/udhcpc-hook.sh.in b/sh/udhcpc-hook.sh.in deleted file mode 100644 index 0744a04c..00000000 --- a/sh/udhcpc-hook.sh.in +++ /dev/null @@ -1,117 +0,0 @@ -#!@SHELL@ -# busybox udhcp setup script - -PATH=/bin:/usr/bin:/sbin:/usr/sbin - -peer_var() -{ - [ -n "$1" ] && [ "$1" != "yes" ] -} - -update_dns() -{ - peer_var "${PEER_DNS}" && return - [ -z "${domain}" ] && [ -z "${dns}" ] && return - - conf="# Generated by udhcpc for ${interface}\n" - [ -n "${domain}" ] && conf="${conf}domain ${domain}\n" - for i in ${dns} ; do - conf="${conf}nameserver ${i}\n" - done - if [ -x /sbin/resolvconf ] ; then - printf "${conf}" | resolvconf -a ${interface} - else - printf "${conf}" > /etc/resolv.conf - chmod 644 /etc/resolv.conf - fi -} - -update_ntp() -{ - peer_var "${PEER_NTP}" && return - [ -z "${ntpsrv}" ] && return - - conf="# Generated by udhcpc for interface ${interface}\n" - conf="${conf}restrict default noquery notrust nomodify\n" - conf="${conf}restrict 127.0.0.1\n" - for i in ${ntpsrv} ; do - conf="${conf}restrict ${i} nomodify notrap noquery\n" - conf="${conf}server ${i}\n" - done - conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" - conf="${conf}logfile /var/log/ntp.log\n" - printf "${conf}" > /etc/ntp.conf - chmod 644 /etc/ntp.conf -} - -update_hostname() -{ - peer_var "${PEER_HOSTNAME}" && return - [ -z "${hostname}" ] && return - - myhost="$(hostname)" - [ -z "${myhost}" ] || [ "${myhost}" = "(none)" ] && hostname "${hostname}" -} - -update_interface() -{ - [ -n "${broadcast}" ] && broadcast="broadcast ${broadcast}" - [ -n "${subnet}" ] && netmask="netmask ${subnet}" - [ -n "${mtu}" ] && mtu="mtu ${mtu}" - ifconfig "${interface}" ${ip} ${broadcast} ${netmask} ${mtu} -} - -update_routes() -{ - peer_var "${PEER_ROUTERS}" && return - - if [ -n "${router}" ] ; then - metric= - [ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}" - for i in ${router} ; do - route add default gw "${i}" ${metric} dev "${interface}" - done - fi -} - -deconfig() -{ - ifconfig "${interface}" 0.0.0.0 - - if ! peer_var "${PEER_ROUTERS}" ; then - while route del default dev "${interface}" >/dev/null 2>&1; do - : - done - fi - - if ! peer_var "${PEER_DNS}" ; then - [ -x /sbin/resolvconf ] && resolvconf -d "${interface}" - fi -} - -if [ -r "/var/run/udhcpc-${interface}.conf" ]; then - . "/var/run/udhcpc-${interface}.conf" -fi - -case "$1" in - bound|renew) - update_hostname - update_interface - update_routes - update_dns - update_ntp - ;; - deconfig|leasefail) - deconfig - ;; - nak) - echo "nak: ${message}" - ;; - *) - echo "unknown option $1" >&2 - echo "Usage: $0 {bound|deconfig|leasefail|nak|renew}" >&2 - exit 1 - ;; -esac - -exit 0 |