summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2006-04-24 14:30:20 +0000
committerChristian Heim <phreak@gentoo.org>2006-04-24 14:30:20 +0000
commitc7b10efd125522f3beeb3144b8a5b4cc511d93cf (patch)
tree09506e4c389d58f5303799712bf9dfcae8117835
parentMerging r1965 (diff)
downloadbaselayout-vserver-c7b10efd125522f3beeb3144b8a5b4cc511d93cf.tar.gz
baselayout-vserver-c7b10efd125522f3beeb3144b8a5b4cc511d93cf.tar.bz2
baselayout-vserver-c7b10efd125522f3beeb3144b8a5b4cc511d93cf.zip
Merging r2014
svn path=/baselayout-vserver/trunk/; revision=341
-rw-r--r--ChangeLog56
-rw-r--r--ChangeLog.vserver4
-rw-r--r--etc/conf.d/local.start2
-rw-r--r--etc/conf.d/rc11
-rw-r--r--man/rc-update.89
-rw-r--r--net-scripts/conf.d/net.example30
-rwxr-xr-xnet-scripts/init.d/net.lo5
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhclient-wrapper50
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhcp123
-rw-r--r--net-scripts/net.modules.d/helpers.d/dhcp-state28
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/dhcpcd-wrapper63
-rw-r--r--net-scripts/net.modules.d/helpers.d/functions566
-rw-r--r--net-scripts/net.modules.d/helpers.d/module-loader63
-rw-r--r--net-scripts/net.modules.d/helpers.d/pppd-wrapper46
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/pump-wrapper32
-rwxr-xr-xnet-scripts/net.modules.d/helpers.d/udhcpc-wrapper28
-rw-r--r--net-scripts/net/adsl.sh (renamed from net-scripts/net.modules.d/adsl.sh)0
-rw-r--r--net-scripts/net/apipa.sh (renamed from net-scripts/net.modules.d/apipa.sh)0
-rw-r--r--net-scripts/net/arping.sh (renamed from net-scripts/net.modules.d/arping.sh)3
-rw-r--r--net-scripts/net/bonding.sh (renamed from net-scripts/net.modules.d/bonding.sh)0
-rw-r--r--net-scripts/net/br2684ctl.sh66
-rw-r--r--net-scripts/net/bridge.sh (renamed from net-scripts/net.modules.d/bridge.sh)0
-rw-r--r--net-scripts/net/ccwgroup.sh55
-rw-r--r--net-scripts/net/dhclient.sh (renamed from net-scripts/net.modules.d/dhclient.sh)5
-rw-r--r--net-scripts/net/dhcpcd.sh (renamed from net-scripts/net.modules.d/dhcpcd.sh)2
-rw-r--r--net-scripts/net/essidnet.sh (renamed from net-scripts/net.modules.d/essidnet.sh)0
-rw-r--r--net-scripts/net/ifconfig.sh (renamed from net-scripts/net.modules.d/ifconfig.sh)2
-rw-r--r--net-scripts/net/ifplugd.sh (renamed from net-scripts/net.modules.d/ifplugd.sh)0
-rw-r--r--net-scripts/net/ip6to4.sh (renamed from net-scripts/net.modules.d/ip6to4.sh)0
-rw-r--r--net-scripts/net/ipppd.sh (renamed from net-scripts/net.modules.d/ipppd.sh)0
-rw-r--r--net-scripts/net/iproute2.sh (renamed from net-scripts/net.modules.d/iproute2.sh)0
-rw-r--r--net-scripts/net/iptunnel.sh (renamed from net-scripts/net.modules.d/iptunnel.sh)0
-rw-r--r--net-scripts/net/iwconfig.sh (renamed from net-scripts/net.modules.d/iwconfig.sh)0
-rw-r--r--net-scripts/net/macchanger.sh (renamed from net-scripts/net.modules.d/macchanger.sh)0
-rw-r--r--net-scripts/net/macnet.sh (renamed from net-scripts/net.modules.d/macnet.sh)0
-rw-r--r--net-scripts/net/netplugd.sh (renamed from net-scripts/net.modules.d/netplugd.sh)0
-rw-r--r--net-scripts/net/pppd.sh (renamed from net-scripts/net.modules.d/pppd.sh)2
-rw-r--r--net-scripts/net/pump.sh (renamed from net-scripts/net.modules.d/pump.sh)0
-rw-r--r--net-scripts/net/rename.sh (renamed from net-scripts/net.modules.d/rename.sh)0
-rw-r--r--net-scripts/net/system.sh (renamed from net-scripts/net.modules.d/system.sh)0
-rw-r--r--net-scripts/net/tuntap.sh (renamed from net-scripts/net.modules.d/tuntap.sh)0
-rw-r--r--net-scripts/net/udhcpc.sh (renamed from net-scripts/net.modules.d/udhcpc.sh)38
-rw-r--r--net-scripts/net/vlan.sh (renamed from net-scripts/net.modules.d/vlan.sh)9
-rw-r--r--net-scripts/net/wpa_supplicant.sh (renamed from net-scripts/net.modules.d/wpa_supplicant.sh)42
-rwxr-xr-xsbin/depscan.sh56
-rwxr-xr-xsbin/rc-daemon.sh2
-rwxr-xr-xsbin/rc-services.sh34
-rwxr-xr-xsbin/rc-update6
-rwxr-xr-xsbin/runscript.sh8
-rw-r--r--src/Makefile3
-rwxr-xr-xtarball.sh2
51 files changed, 365 insertions, 1086 deletions
diff --git a/ChangeLog b/ChangeLog
index edbf2e1..62c405e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,62 @@
Give a better error message when no valid DHCP client is installed.
+* baselayout-1.12.0_pre18 (22 Apr 2006)
+
+ 22 Apr 2006; Mike Frysinger <vapier@gentoo.org>:
+
+ Touchup fuser arguments in halt.sh so we dont have to pipe to /dev/null.
+
+ 22 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc module now requires udhcp-0.9.9_pre20041216-r3 or newer with
+ the --env command option.
+
+ 21 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ br2684 module should now work correctly.
+ Document usage of br2684 module.
+
+ move /lib/rcscripts/net.modules.d to /lib/rcscripts/net
+
+ 20 Apr 2006; Mike Frysinger <vapier@gentoo.org>:
+
+ Document --verbose option in rc-update #130643 by Christian Heim.
+
+ 18 Apr 2006; Mike Frysinger <vapier@gentoo.org>:
+
+ Sort by mount point, not mount source, in halt.sh #130219 by Mark McKenna.
+
+ Disable CTRL+C in depscan.sh while booting #126512 by Marko Djukic.
+
+ 18 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ start-stop-daemon only removes the daemon stopping from the daemon
+ started list, #130166.
+
+ 15 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ net services are now calculated properly in trace_dependencies.
+
+ arping.sh now tests if the interface exists or not.
+
+ 12 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ vlans can now be configured with their own interface scripts, which
+ means that they can now be renamed, #128283.
+ Thanks to Jonathan deBoer.
+
+ 11 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ udhcpc.sh now works with the -q|--quit option again, #129437.
+
+ 09 Apr 2006; Roy Marples <uberlord@gentoo.org>:
+
+ RC_COLDPLUG now controls if we add coldplugged services to the boot
+ runlevel or not, #129331.
+
+ The ccwgroup module now really works!
+
* baselayout-1.12.0_pre17 (08 Apr 2006)
07 Apr 2006; Roy Marples <uberlord@gentoo.org>:
diff --git a/ChangeLog.vserver b/ChangeLog.vserver
index 021ffdb..169ca5c 100644
--- a/ChangeLog.vserver
+++ b/ChangeLog.vserver
@@ -1,6 +1,10 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2
+ 21 Apr 2006; Christian Heim <phreak@gentoo.org>:
+ Merging latest changes to the baselayout/trunk changes. This merge is based
+ upon revision 2014.
+
08 Apr 2006; Christian Heim <phreak@gentoo.org>:
Merging latest changes to the baselayout/trunk changes. This merge is based
upon revision 1965.
diff --git a/etc/conf.d/local.start b/etc/conf.d/local.start
index a55d2cc..7a20c14 100644
--- a/etc/conf.d/local.start
+++ b/etc/conf.d/local.start
@@ -1,5 +1,5 @@
# /etc/conf.d/local.start
# This is a good place to load any misc programs
-# on startup ( use 1>&2 to hide output)
+# on startup (use &>/dev/null to hide output)
diff --git a/etc/conf.d/rc b/etc/conf.d/rc
index 3bbcecc..875fd11 100644
--- a/etc/conf.d/rc
+++ b/etc/conf.d/rc
@@ -10,6 +10,17 @@ RC_TTY_NUMBER=0
RC_PARALLEL_STARTUP="no"
+# Dynamic /dev managers can trigger coldplug events which cause services to
+# start before we are ready for them. If this happens, we can defer these
+# services to start in the boot runlevel. If you don't want this then set
+# RC_COLDPLUG to no.
+# For more fine grained control you can list full service names to allow
+# them to coldplug and prefix them with ! so they don't coldplug.
+# Example - RC_COLDPLUG="net.wlan !net.*"
+# This allows net.wlan and any service not matching net.* to coldplug.
+
+RC_COLDPLUG="yes"
+
# RC_NET_STRICT_CHECKING allows some flexibility with the 'net' service.
# The following values are allowed:
# none - The 'net' service is always considered up.
diff --git a/man/rc-update.8 b/man/rc-update.8
index b5b1d8c..47db9ad 100644
--- a/man/rc-update.8
+++ b/man/rc-update.8
@@ -6,7 +6,7 @@ rc-update \- add and remove init scripts to a runlevel
.br
\fBrc-update\fR \fIdel\fR \fIscript\fR \fI[runlevels]\fR
.br
-\fBrc-update\fR \fIshow\fR \fI[runlevels]\fR
+\fBrc-update\fR \fIshow\fR \fI[\-\-verbose]\fR \fI[runlevels]\fR
.SH DESCRIPTION
Gentoo's init system uses named runlevels. Rather than editing some obscure
file or managing a directory of symlinks, \fBrc-update\fR exists to quickly
@@ -29,9 +29,10 @@ will be removed from all exists runlevels.
Example: rc-update del sysklogd
.TP
-\fBshow (\-s)\fR \fI[runlevels]\fR
-Show all init scripts and the runlevels they belong to. If you specify
-\fIrunlevels\fR to show, then only those will be included in the output.
+\fBshow (\-s)\fR \fI[\-v|\-\-verbose]\fR \fI[runlevels]\fR
+Show all enabled scripts and the runlevels they belong to. If you specify
+\fIrunlevels\fR to show, then only those will be included in the output. To
+view all init scripts, run with the \fI\-\-verbose\fR option.
Example: rc-update show
.SH "REPORTING BUGS"
diff --git a/net-scripts/conf.d/net.example b/net-scripts/conf.d/net.example
index 9521449..f103905 100644
--- a/net-scripts/conf.d/net.example
+++ b/net-scripts/conf.d/net.example
@@ -316,6 +316,15 @@
# NOTE: Vlans are controlled by their physical interface and not per vlan
# This means you do not need to create init scripts in /etc/init.d for each
# vlan, you must need to create one for the physical interface.
+# If you wish to control the configuration of each vlan through a seperate
+# script, or wish to rename the vlan interface to something that vconfig
+# cannot then you need to do this.
+#vlan_start_eth0="no
+
+# If you do the above then you may want to depend on eth0 like so
+# depend_vlan1() {
+# need net.eth0
+# }
#-----------------------------------------------------------------------------
# Bonding
@@ -352,7 +361,7 @@
#link_ppp0="/dev/ttyS0" # Most PPP links will use a serial port
#link_ppp0="eth0" # PPPoE requires an ethernet interface
#link_ppp0="/dev/null" # PPPoA and ISDN links should have this
-#link_ppp0="pty $(your_link_command)" # PPP links over ssh, rsh, etc
+#link_ppp0="pty 'your_link_command'" # PPP links over ssh, rsh, etc
#
# Here you should specify what pppd plugins you want to use
# Available plugins are: pppoe, pppoa, capi, dhcpc, minconn, radius,
@@ -426,6 +435,14 @@
# '~--' ''
#)
+# If the link require extra configuration - for example wireless or
+# RFC 268 bridge - we need to write a depend function for the bridge so they get
+# configured correctly.
+# This is exactly the same as a depend() function in our init scripts
+#depend_ppp0() {
+# need net.nas0
+#}
+
#-----------------------------------------------------------------------------
# ADSL
# For ADSL support, emerge net-dialup/rp-pppoe
@@ -533,6 +550,17 @@
#brctl_br0=( "setfd 0" "sethello 0" "stp off" )
#-----------------------------------------------------------------------------
+# RFC 2684 Bridge Support
+# For RFC 2684 bridge support emerge net-misc/br2684ctl
+
+# Interface names have to be of the form nas0, nas1, nas2, etc.
+# You have to specify a VPI and VCI for the interface like so
+#br2684ctl_nas0="-a 0.38" # UK VPI and VCI
+
+# Then you can configure the interface as normal
+#config_nas0=( "192.168.0.1/24" )
+
+#-----------------------------------------------------------------------------
# Tunnelling
# WARNING: For tunnelling it is highly recommended that you
# emerge sys-apps/iproute2
diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo
index da12257..ed46320 100755
--- a/net-scripts/init.d/net.lo
+++ b/net-scripts/init.d/net.lo
@@ -19,12 +19,13 @@ depend() {
# For example, br0 may need eth0 and eth1
local iface="${SVCNAME#*.}"
[[ $(type -t "depend_${iface}") == "function" ]] && depend_${iface}
+ [[ ${iface} != "lo" && ${iface} != "lo0" ]] && after net.lo net.lo0
return 0
}
# Define where our modules are
-MODULES_DIR="${svclib}/net.modules.d"
+MODULES_DIR="${svclib}/net"
# Make some wrappers to fudge after/before/need/use depend flags.
# These are callbacks so MODULE will be set.
@@ -53,7 +54,7 @@ variables() {
}
is_loopback() {
- [[ $1 == "lo" || $1 == "lo"[0-9]* ]]
+ [[ $1 == "lo" || $1 == "lo0" ]]
}
# char* interface_device(char *iface)
diff --git a/net-scripts/net.modules.d/helpers.d/dhclient-wrapper b/net-scripts/net.modules.d/helpers.d/dhclient-wrapper
deleted file mode 100755
index c2d980b..0000000
--- a/net-scripts/net.modules.d/helpers.d/dhclient-wrapper
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2004-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-# Instead of writing new functions for dhclient, we simply map their variables
-# over to udhcpc style ones and call those scripts!
-
-[[ -e /etc/dhcp/dhclient-enter-hooks ]] \
- && ( source /etc/dhcp/dhclient-enter-hooks )
-
-case "${reason}" in
- BOUND|REBOOT|REBIND) action="bound" ;;
- RENEW) action="renew" ;;
- RELEASE|PREINIT|FAIL|EXPIRE|TIMEOUT) action="deconfig" ;;
- MEDIUM) exit 0 ;;
-esac
-
-if [[ -z ${action} ]] ; then
- echo "dhclient sent an unknown action ${reason}!" >&2
- exit 1
-fi
-
-export ip="${new_ip_address}"
-export subnet="${new_subnet_mask}"
-export broadcast="${new_broadcast_address}"
-export routers="${new_routers}"
-
-export hostname="${new_host_name}"
-
-export dns_domain_${interface}="${new_domain_name}"
-export dns_servers_${interface}="${new_domain_name_servers}"
-
-export ntp_servers_${interface}="${new_domain_name_servers}"
-
-export nis_domain_${interface}="${new_nis_domain}"
-export nis_servers_${interface}="${new_nis_servers}"
-
-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
-RC_QUIET_STDOUT="yes"
-
-"${svclib}/net.modules.d/helpers.d/dhcp" "${action}"
-result="$?"
-
-[[ -e /etc/dhcp/dhclient-exit-hooks ]] \
- && ( source /etc/dhcp/dhclient-exit-hooks )
-
-exit "${result}"
-
-# vim: ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp b/net-scripts/net.modules.d/helpers.d/dhcp
deleted file mode 100755
index d210705..0000000
--- a/net-scripts/net.modules.d/helpers.d/dhcp
+++ /dev/null
@@ -1,123 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2004-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-action="$1"
-service="net.${interface}"
-
-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
-RC_QUIET_STDOUT="yes"
-
-source "${svclib}/net.modules.d/helpers.d/module-loader"
-
-# Bring the interface up
-interface_is_up "${interface}" || interface_up "${interface}"
-
-case "${action}" in
- bound|renew)
- # We handle these actions below
- ;;
- deconfig|leasefail)
- # Just remove IPv4 / inet addresses
- interface_del_addresses "${interface}" true
- service_started "${service}" && mark_service_inactive "${service}"
- remove_state "${interface}"
- if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then
- if service_inactive "${service}" ; then
- best_interface="$(select_best_interface)"
- apply_state "${best_interface}"
- fi
- fi
- echo "${action}"
- exit 0
- ;;
- nak)
- echo "${action}"
- exit 0
- ;;
- *)
- echo "${action}"
- echo "We don't handle that action" >&2
- exit 1
- ;;
-esac
-
-# Map MAC address variables to interface variables
-macnet_pre_start "${interface}"
-
-# Map wireless ESSID variables to interface variables
-if [[ -n ${wireless_module} ]] ; then
- if wireless_exists "${interface}" ; then
- essidnet_pre_start "${interface}"
- fi
-fi
-
-# Calculate the metric for our routes
-ifvar="$(bash_variable "${interface}")"
-metric="metric_${ifvar}"
-metric="${!metric}"
-if [[ -z ${metric} ]] ; then
- if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then
- metric="$(calculate_metric "${interface}")"
- else
- metric="0"
- fi
- eval metric_${ifvar}="${metric}"
-fi
-
-# Configure our IP address
-ip="${ip// /}"
-subnet="${subnet// /}"
-cidr="$(netmask2cidr "${subnet}")"
-broadcast="${broadcast// /}"
-[[ -n ${broadcast} ]] && broadcast="broadcast ${broadcast}"
-
-# If we don't have our address then we flush it and then add our new one
-curip="$(interface_get_address "${interface}")"
-if [[ ${curip} != "${ip}/${cidr}" ]] ; then
- # Just remove IPv4 / inet addresses
- interface_del_addresses "${interface}" true
- interface_add_address "${interface}" "${ip}/${cidr}" "${broadcast}"
-fi
-
-d="dhcp_${ifvar}"
-d=" ${!d} "
-[[ ${d} == " " ]] && d=" ${dhcp} "
-
-# Configure our default route - we only have 1 default route
-if [[ ${d} != *" nogateway "* ]] ; then
- for r in ${routers}; do
- interface_default_route "${interface}" "${r}" "${metric:-0}" && break
- done
-fi
-
-# Configure our hostname - but only if we need it
-if [[ -n ${hostname} ]] ; then
- x="$(hostname)"
- [[ ${x} == "(none)" || ${x} == "localhost" ]] && hostname "${hostname}"
-fi
-
-[[ ! -d "${statedir}/${interface}" ]] \
- && mkdir -m 0755 -p "${statedir}/${interface}"
-
-# Only setup the information we're told to
-# By default that's everything
-[[ ${d} != *" nodns "* ]] && system_dns "${interface}"
-[[ ${d} != *" nontp "* ]] && system_ntp "${interface}"
-[[ ${d} != *" nonis "* ]] && system_nis "${interface}"
-
-if service_inactive "${service}" ; then
- mark_service_started "${service}"
- if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then
- best_interface="$(select_best_interface)"
- apply_state "${best_interface}"
- else
- apply_state "${interface}"
- fi
-fi
-
-echo "${action}"
-exit 0
-
-# vim: ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/dhcp-state b/net-scripts/net.modules.d/helpers.d/dhcp-state
deleted file mode 100644
index b16e6cc..0000000
--- a/net-scripts/net.modules.d/helpers.d/dhcp-state
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (c) 2005-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-source "${svclib}/sh/rc-services.sh"
-source "${svclib}/net.modules.d/helpers.d/functions"
-conf="$(add_suffix /etc/conf.d/net)"
-[[ -e ${conf} ]] && source "${conf}"
-
-service="net.${interface}"
-
-if [[ ${action} != "up" ]] ; then
- service_started "${service}" && mark_service_inactive "${service}"
- remove_state "${interface}" false
-else
- service_inactive "${service}" && mark_service_started "${service}"
-fi
-
-if service_started "${service}" || service_inactive "${service}" ; then
- if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then
- best_interface="$(select_best_interface)"
- apply_state "${best_interface}"
- elif [[ ${action} == "up" ]] ; then
- apply_state "${interface}"
- fi
-fi
-
-# vim: set ft=sh ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper b/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper
deleted file mode 100755
index ca4778b..0000000
--- a/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2005-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-interface="${1##*/dhcpcd-}"
-interface="${interface%%.info}"
-
-if [[ $2 != "up" && $2 != "new" ]] ; then
- action="down"
-else
- action="up"
-fi
-
-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
-RC_QUIET_STDOUT="yes"
-source "${svclib}/net.modules.d/helpers.d/module-loader"
-
-# Map MAC address variables to interface variables
-macnet_pre_start "${interface}"
-
-# Map wireless ESSID variables to interface variables
-if [[ -n ${wireless_module} ]] ; then
- if wireless_exists "${interface}" ; then
- essidnet_pre_start "${interface}"
- fi
-fi
-
-# Add any search paths if we have any defined
-ifvar="$(bash_variable "${interface}")"
-
-if [[ ${action} == "up" ]] ; then
- d="dhcp_${ifvar}"
- d=" ${!d} "
- [[ ${d} == " " ]] && d=" ${dhcp} "
- resolv="${statedir}/${interface}/resolv.conf"
-
- if [[ ${d} != *" nodns "* ]] ; then
- search="dns_search_${ifvar}"
- if [[ -n ${!search} ]] ; then
- tmp="${resolv}.$$"
- egrep -v "^[ \t]*(search|domain)[ \t]*" "${resolv}" > "${tmp}"
- echo "search ${!search}" >> "${tmp}"
- mv "${tmp}" "${resolv}"
- fi
- fi
-
- system_dns_extra "${interface}" "${resolv}"
-fi
-
-# As we override the -c option, we need to call the specified script ourself
-opts="dhcpcd_${ifvar}"
-exe="${!opts##* -c }"
-if [[ -n ${exe} && ${exe} != "${!opts}" ]] ; then
- exe="${exe%% *}"
-else
- exe="/etc/dhcpc/dhcpcd.exe"
-fi
-[[ -x ${exe} ]] && ( ${exe} "$@" 1>/dev/null )
-
-source "${svclib}/net.modules.d/helpers.d/dhcp-state"
-
-# vim: ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/functions b/net-scripts/net.modules.d/helpers.d/functions
deleted file mode 100644
index 6975bf1..0000000
--- a/net-scripts/net.modules.d/helpers.d/functions
+++ /dev/null
@@ -1,566 +0,0 @@
-# Copyright (c) 2004-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-# We will be loaded after conf.d/rc and conf.d/net so we can set a default
-# here.
-RC_AUTO_INTERFACE="${RC_AUTO_INTERFACE:-no}"
-
-netdir="/var/lib/net-scripts"
-statedir="${netdir}/state"
-
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-# char* interface_device(char *iface)
-#
-# Gets the base device of the interface
-# Can handle eth0:1 and eth0.1
-# Which returns eth0 in this case
-interface_device() {
- local dev="${1%%.*}"
- [[ ${dev} == "$1" ]] && dev="${1%%:*}"
- echo "${dev}"
-}
-
-# char* interface_type(char* iface)
-#
-# Returns the base type of the interface
-# eth, ippp, etc
-interface_type() {
- echo "${1%%[0-9]*}"
-}
-
-# void save_state(char *interface)
-#
-# Saves state information regarding the interface
-save_state() {
- local iface="$1"
- local d="${statedir}/${iface}"
-
- [[ ! -d ${d} ]] && mkdir -m 0755 -p "${d}"
- cp -p /etc/resolv.conf /etc/ntp.conf /etc/yp.conf "${d}" 2>/dev/null
-}
-
-# void remove_state(char *interface)
-#
-# Removes state information regarding the interface
-remove_state() {
- local d="${statedir}/$1"
-
- [[ -d ${d} ]] && rm -Rf "${d}" 2>/dev/null
- [[ ! ${2:-true} ]] && mkdir -m 0755 -p "${d}"
-}
-
-# void apply_state(char *interface)
-#
-# Apply's state information about the interface to the system
-# If the files in the state dir are not links back to etc then
-# we create them if RC_AUTO_INTERFACE="yes"
-#
-apply_state() {
- local iface="$1"
-
- if [[ -z ${iface} ]] ; then
- iface="$(select_best_interface)"
- [[ -z ${iface} ]] && return
- fi
-
- local d="${statedir}/${iface}"
- if [[ -d ${d} ]] ; then
- local files="$(ls "${d}")"
- if [[ -n ${files} ]] ; then
- if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then
- cp -pPR "${d}"/* "${netdir}"
- local file
- for file in ${files} ; do
- # Skip .sv files
- [[ ${file} == *".sv" ]] && continue
- local link="$(readlink "/etc/${file}" 2>/dev/null)"
- if [[ ${link} != "${netdir}/${file}" ]] ; then
- [[ -e "/etc/${file}" ]] && rm -f "/etc/${file}"
- ln -snf "${netdir}/${file}" "/etc/${file}"
- fi
- done
- else
- cp -pPR "${d}"/* /etc
- fi
- fi
- fi
-
- [[ ${RC_AUTO_INTERFACE} == "yes" ]] && merge_configs
-}
-
-# char* order_interfaces(bool require_gateway)
-#
-# Lists the interfaces in route metric order that we have configured
-# (ie a state dir exists)
-# require_gateway defaults to false
-order_interfaces() {
- local ifaces extra
-
- ${1:-false} && extra=' && $2=="00000000"'
- ifaces="$(awk '{if (NR>1 && $1!="lo"'"${extra}"') print $7, $1}' \
- /proc/net/route \
- | sort -n | cut -d' ' -f2 | uniq)"
-
- # Append lo if it's up
- if ! ${1:-false} ; then
- if grep -q "^lo[ \t]*" /proc/net/route ; then
- ifaces="${ifaces} lo"
- fi
- fi
-
- local i order
- for i in ${ifaces}; do
- [[ -d "${statedir}/${i}" ]] && order="${order}${i} "
- done
-
- echo "${order}"
-}
-
-# void merge_resolv()
-#
-# Merges the resolv.conf info from active interfaces
-merge_resolv() {
- local -a ifaces=( $(order_interfaces) )
- local i j f
-
- # We only work for ifaces with a resolv.conf
- j=${#ifaces[@]}
- for (( i=0; i<j; i++ )); do
- [[ ! -e "${statedir}/${ifaces[i]}/resolv.conf" ]] && unset ifaces[i]
- done
- ifaces=( "${ifaces[@]}" )
-
- # No point merging unless there are two or more interfaces
- [[ ${#ifaces[@]} -lt 2 ]] && return
-
- veinfo "Merging resolv.conf from interfaces ${ifaces[@]}"
-
- local -a search srvs opts sortlist
- j=0
- for (( i=0; i<${#ifaces[@]}; i++ )); do
- f="${statedir}/${ifaces[i]}/resolv.conf"
- srvs[i]="$(sed -n -e 's/^[ \t]*nameserver[ \t]*\([^#]*\).*/\1/p' \
- "${f}" | sed 2q)"
-
- search[i]="$(sed -n -e 's/^[ \t]*\(domain\|search\)[ \t]*\([^#]*\).*/\2/p' \
- "${f}" | sed -e '$!d')"
-
- opts[i]="$(sed -n -e 's/^[ \t]*options[ \t]*\([^#]*\).*/\1#/p;' "${f}" \
- | xargs )"
- sortlist[i]="$(sed -n -e 's/^[ \t]*sortlist[ \t]*\([^#]*\).*/\1/p' \
- "${f}")"
-
- if [[ -z ${srvs[i]} && -z ${opts[i]} && -z ${sortlist[i]} && -z ${search[i]} ]] ; then
- unset srvs[i]
- unset search[i]
- unset opts[i]
- unset sortlist[i]
- continue
- fi
-
- # No point in handling more than 3 interfaces due to libc limits
- (( j++ ))
- [[ ${j} -gt 2 ]] && break
- done
- srvs=( "${srvs[@]}" )
- search=( ${search[@]} )
- opts=( "${opts[@]}" )
- sortlist=( ${sortlist[@]} )
-
- local new_srvs
- j=0
- # Add interface primary nameservers
- for (( i=0;i<${#srvs[@]}; i++ )); do
- local -a n=( ${srvs[i]} )
- if [[ " ${new_srvs} " != *" ${n[0]} "* ]] ; then
- new_srvs="${new_srvs} ${n[0]}"
- # libc can only handle 3 name servers
- (( j++ ))
- [[ ${j} -gt 2 ]] && break
- fi
- done
-
- # Add interface secondary nameservers
- if [[ ${j} -lt 3 ]] ; then
- for (( i=0;i<${#srvs[@]}; i++ )); do
- local -a n=( ${srvs[i]} )
- [[ -z ${n[1]} ]] && continue
- if [[ " ${new_srvs} " != *" ${n[1]} "* ]] ; then
- new_srvs="${new_srvs} ${n[1]}"
- # libc can only handle 3 name servers
- (( j++ ))
- [[ ${j} -gt 2 ]] && break
- fi
- done
- fi
-
- local new_search n_search=0
- for i in ${search[@]}; do
- if [[ " ${new_search} " != *" ${i} "* ]] ; then
- new_search="${new_search} ${i}"
- # libc limits us to 6 search domains
- (( n_search++ ))
- [[ ${n_search} -gt 5 ]] && break
- fi
- done
-
- local new_opts
- for i in "${opts[@]}"; do
- new_opts="${new_opts}#${i}"
- done
-
- # Remove duplicate options
- new_opts="$(
- echo -e "${new_opts//\#/\n}" \
- | sort -u | sed -e 's/^/#/g' | xargs \
- )"
-
- local new_sortlist n_sortlist=0
- for i in ${sortlist[@]}; do
- if [[ " ${new_sortlist} " != *" ${i} "* ]] ; then
- new_sortlist="${new_sortlist} ${i}"
- # libc limits us to 10 items
- (( n_sortlist++ ))
- [[ ${n_sortlist} -gt 9 ]] && break
- fi
- done
-
- # Now we create a new resolv.conf to use
- local f="${netdir}/resolv.conf.$$"
- echo "# Generated by net-scripts from interfaces ${ifaces[@]}" > "${f}"
- chmod 644 "${f}"
- for i in ${new_srvs[@]}; do
- echo "nameserver ${i}" >> "${f}"
- done
- if [[ -n ${new_search} ]] ; then
- if [[ ${n_search} == "1" ]] ; then
- echo "domain${new_search}" >> "${f}"
- else
- echo "search${new_search}" >> "${f}"
- fi
- fi
-
- [[ -n ${new_sortlist} ]] && echo "sortlist${new_sortlist}" >> "${f}"
-
- # We seperated the options out using # in our sed call above
- # so we set IFS here. If you do any spliting futher down in this function
- # then you will need to reset IFS.
- local IFS="#"
- for i in ${new_opts}; do
- [[ -n ${i# } ]] && echo "options ${i# }" >> "${f}"
- done
-
- mv "${f}" "${netdir}/resolv.conf"
-}
-
-
-# void merge_ntp()
-#
-# Merges the ntp.conf info from active interfaces
-merge_ntp() {
- local -a ifaces=( $(order_interfaces) )
- local i j f
-
- # We only work for ifaces with a ntp.conf
- j=${#ifaces[@]}
- for (( i=0; i<j; i++ )); do
- [[ ! -e "${statedir}/${ifaces[i]}/ntp.conf" ]] && unset ifaces[i]
- done
- ifaces=( "${ifaces[@]}" )
-
- # No point merging unless there are two or more interfaces
- [[ ${#ifaces[@]} -lt 2 ]] && return
-
- veinfo "Merging ntp.conf from interfaces ${ifaces[@]}"
-
- local srvs
- for (( i=0; i<${#ifaces[@]}; i++ )); do
- f="${statedir}/${ifaces[i]}/ntp.conf"
- srvs="${srvs} $( sed -n -e 's/^[ \t]*server[ \t]*\([^#]\)/\1/p' "${f}" )"
- done
-
- # ntp does it's own preference list, so we just remove duplicates
- sort_unique() {
- set -- " ${@/%/\n}"
- echo -e "$@" | sort -u
- }
-
- srvs="$(sort_unique ${srvs})"
-
- f="${netdir}/ntp.conf.$$"
- echo "# Generated by net-scripts for interfaces ${ifaces[@]}" > "${f}"
- chmod 644 "${f}"
-
- echo "restrict default noquery notrust nomodify" >> "${f}"
- echo "restrict 127.0.0.1" >> "${f}"
-
- for i in ${srvs}; do
- echo "restrict ${i} nomodify notrap noquery" >> "${f}"
- echo "server ${i}" >> "${f}"
- done
-
- echo "driftfile /var/lib/ntp/ntp.drift" >> "${f}"
- echo "logfile /var/log/ntp.log" >> "${f}"
-
- mv "${f}" "${netdir}/ntp.conf"
-}
-
-# void merge_configs()
-#
-# Merge config files together
-merge_configs() {
- merge_resolv
- merge_ntp
-}
-
-# char* select_best_interface()
-#
-# Selects the best interface to apply state information to
-# This is currently based on routing metrics
-select_best_interface() {
- local -a ifs=( $(order_interfaces) )
-
- # Move lo to the back of the pecking order of it's active
- local x=" ${ifs[@]} "
- [[ ${x// lo / } != "${x}" ]] && ifs=( ${x// lo / } lo )
-
- local iface
- for iface in ${ifs[@]} ; do
- if [[ -e "${statedir}/${iface}/resolv.conf" ]] ; then
- echo "${iface}"
- return 0
- fi
- done
-
- echo "${ifs[0]}"
-}
-
-# int calculate_metric(char *interface)
-#
-# Calculates the best metric for the interface
-# The Linux kernel does not use this at the moment, but we use it so that
-# default routes remain and we can work out the "best" interface
-calculate_metric() {
- local iface="$1" exclude='$1!="Iface" && $1!="lo"'
-
- # Have we already got a metric?
- local m="$( awk '$1=="'${iface}'" && $2=="00000000" { print $7 }' \
- /proc/net/route )"
- if [[ -n ${m} ]] ; then
- echo "${m}"
- return 0
- fi
-
- local itype="$(interface_type "${iface}")" x i
-
- # If we're not a wireless device then exclude wireless from the
- # routing table so we stay < 1000
- if [[ -e /proc/net/wireless ]] ; then
- if ! grep -q "^[ \t]*${iface}:[ \t]" /proc/net/wireless ; then
- local i="$(sed -n -e 's/^[ \t]*\(.*\):.*/\1/p' /proc/net/wireless)"
- for x in ${i} ; do
- exclude="${exclude} && "'$1'"!=\"${x}\""
- done
- fi
- fi
-
- # Exclude ppp and ippp as well
- local ix="ppp|ippp"
- [[ ${itype} == "ppp" ]] && ix="ippp"
- [[ ${itype} == "ippp" ]] && ix="ppp"
- i="$( sed -n -e 's/^[ ]*\('"${ix}"'[0-9]*\):.*$/\1/p' /proc/net/dev )"
- for x in ${i} ; do
- exclude="${exclude} && "'$1'"!=\"${x}\""
- done
-
- local m="$( awk "${exclude} { print "'$7'" }" /proc/net/route \
- | sort -rn | head -n 1 | cut -d' ' -f2 )"
- m="${m:--1}"
- (( m ++ ))
-
- # If we're a wireless device then add 1000 so that wired interfaces take preference
- if [[ -e /proc/net/wireless ]] ; then
- grep -q "^[ \t]*${iface}:[ \t]" /proc/net/wireless && (( m+= 1000 ))
- fi
-
- # If we're a ppp device then we add 2000 for ISDN, otherwise 3000
- [[ ${itype} == "ippp" ]] && (( m+= 2000 ))
- [[ ${itype} == "ppp" ]] && (( m+= 3000 ))
-
- echo "${m}"
-}
-
-# int netmask2cidr(char *netmask)
-#
-# Returns the CIDR of a given netmask
-netmask2cidr() {
- local binary="" i bin
-
- for i in ${1//./ }; do
- bin=""
- while [[ ${i} != "0" ]] ; do
- bin=$[${i}%2]${bin}
- (( i=i>>1 ))
- done
- binary="${binary}${bin}"
- done
- binary="${binary%%0*}"
- echo "${#binary}"
-}
-
-# char* netmask2cidr(int cidr)
-#
-# Returns the netmask of a given CIDR
-cidr2netmask() {
- local cidr="$1" netmask="" done=0 i sum=0 cur=128
- local octets frac
-
- (( octets=cidr/8 ))
- (( frac=cidr%8 ))
- while [[ octets -gt 0 ]] ; do
- netmask="${netmask}.255"
- (( octets-- ))
- (( done++ ))
- done
-
- if [[ ${done} -lt 4 ]] ; then
- for (( i=0; i<${frac}; i++ )); do
- (( sum+=cur ))
- (( cur/=2 ))
- done
- netmask="${netmask}.${sum}"
- (( done++ ))
-
- while [[ ${done} -lt 4 ]] ; do
- netmask="${netmask}.0"
- (( done++ ))
- done
- fi
-
- echo "${netmask:1}"
-}
-
-# char* ip_network(char *ip, char *netmask)
-#
-# Returns the network of the ip address
-# ip can be 192.168.0.51/24
-# or
-# ip can be 192.168.0.51 and netmask is 255.255.255.0
-ip_network() {
- local ip="$1" mask="$2" i network x
-
- # We only work for IPv4 addresses
- [[ ${ip} != *.*.*.* ]] && return
-
- # If we didn't get parameter 2 then assume we have a CIDR
- if [[ -z ${mask} ]] ; then
- mask="${ip##*/}"
- [[ -z ${mask} || ${mask} == ${ip} ]] && return 1
- mask="$(cidr2netmask "${mask}")"
- ip="${ip%%/*}"
- fi
-
- ip=( ${ip//./ } )
- mask=( ${mask//./ } )
-
- for (( i=0; i<4; i++ )); do
- (( x=ip[i] & mask[i] ))
- network="${network}${x}"
- [[ ${i} -lt 3 ]] && network="${network}."
- done
-
- echo "${network}"
-}
-
-# bool is_function(char* name)
-#
-# Returns 0 if the given name is a shell function, otherwise 1
-is_function() {
- [[ -z $1 ]] && return 1
- [[ $(type -t "$1") == "function" ]]
-}
-
-# void function_wrap(char* source, char* target)
-#
-# wraps function calls - for example function_wrap(this, that)
-# maps function names this_* to that_*
-function_wrap() {
- local i
-
- is_function "${2}_depend" && return
-
- for i in $( typeset -f | grep -o '^'"${1}"'_[^ ]*' ); do
- eval "${2}${i#${1}}() { ${i} \"\$@\"; }"
- done
-}
-
-# char[] * expand_parameters(char *cmd)
-#
-# Returns an array after expanding parameters. For example
-# "192.168.{1..3}.{1..3}/24 brd +"
-# will return
-# "192.168.1.1/24 brd +"
-# "192.168.1.2/24 brd +"
-# "192.168.1.3/24 brd +"
-# "192.168.2.1/24 brd +"
-# "192.168.2.2/24 brd +"
-# "192.168.2.3/24 brd +"
-# "192.168.3.1/24 brd +"
-# "192.168.3.2/24 brd +"
-# "192.168.3.3/24 brd +"
-expand_parameters() {
- local x="$( eval echo ${@// /_} )"
- local -a a=( ${x} )
-
- a=( "${a[@]/#/\"}" )
- a=( "${a[@]/%/\"}" )
- echo "${a[*]//_/ }"
-}
-
-# void configure_variables(char *interface, char *option1, [char *option2])
-#
-# Maps configuration options from <variable>_<option> to <variable>_<iface>
-# option2 takes precedence over option1
-configure_variables() {
- local iface="$1" option1="$2" option2="$3"
-
- local mod func x i
- local -a ivars ovars1 ovars2
- local ifvar="$(bash_variable "${iface}")"
-
- for mod in ${MODULES[@]}; do
- is_function ${mod}_variables || continue
- for v in $(${mod}_variables) ; do
- x=""
- [[ -n ${option2} ]] && x="${v}_${option2}[@]"
- [[ -z ${!x} ]] && x="${v}_${option1}[@]"
- [[ -n ${!x} ]] && eval "${v}_${ifvar}=( \"\${!x}\" )"
- done
- done
-
- return 0
-}
-
-# Provide a wrapper for hostname if it's not available
-if [[ -z $(type -p hostname) ]] ; then
- hostname() {
- # Linux and *BSD seem to differ
- local kernel="kern" ctl="hostname"
- [[ $(uname) == "Linux" ]] && kernel="kernel"
-
- if [[ $1 == "-y" || $1 == "--yp" || $1 == "nis" ]] ; then
- ctl="domainname"
- shift
- fi
-
- if [[ -n $1 ]] ; then
- sysctl -q -w "${kernel}.${ctl}=$1"
- else
- sysctl -n "${kernel}.${ctl}"
- fi
- }
-fi
-
-# vim: set ft=sh ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/module-loader b/net-scripts/net.modules.d/helpers.d/module-loader
deleted file mode 100644
index e0477d4..0000000
--- a/net-scripts/net.modules.d/helpers.d/module-loader
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (c) 2004-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-source "${svclib}/sh/rc-services.sh"
-
-MODULES_DIR="${svclib}/net.modules.d"
-source "${MODULES_DIR}/system"
-source "${MODULES_DIR}/helpers.d/functions"
-
-conf="$(add_suffix /etc/conf.d/net)"
-[[ -e ${conf} ]] && source "${conf}"
-conf="$(add_suffix "/etc/conf.d/net.${interface}")"
-[[ -e ${conf} ]] && source "${conf}"
-
-# So we can expose module variables
-variables() { eval "${MODULE}_variables() { echo \"$*\"; }"; }
-
-# Guess which interface module to load - we prefer iproute2
-if [[ -x /sbin/ip ]] ; then
- interface_module="iproute2"
-elif [[ -x /sbin/ifconfig ]] ; then
- interface_module="ifconfig"
-else
- echo "Can't find a known interface module" >&2
- exit 1
-fi
-
-# iwconfig is the best bet for wireless - we use wpa_supplicant
-# only if we need to
-if [[ -x /sbin/iwconfig ]] ; then
- wireless_module="iwconfig"
-elif [[ -x /sbin/wpa_supplicant \
- && -S "/var/run/wpa_supplicant/${interface}" ]] ; then
- wireless_module="wpa_supplicant"
-fi
-
-MODULES=( "system" )
-
-# Load our modules
-source "${MODULES_DIR}/${interface_module}"
-MODULE="interface"
-${interface_module}_expose
-function_wrap "${interface_module}" interface
-
-if [[ -e "${MODULES_DIR}/macnet" ]] ; then
- source "${MODULES_DIR}/macnet"
-fi
-
-. "${MODULES_DIR}/system"
-MODULE="system"
-system_expose
-
-if [[ -n ${wireless_module} ]] ; then
- source "${MODULES_DIR}/${wireless_module}"
- function_wrap "${wireless_module}" wireless
- source "${MODULES_DIR}/essidnet"
-fi
-
-# Dummy dhcp
-dhcp_variables() { echo "dhcp"; }
-
-# vim: set ft=sh ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/pppd-wrapper b/net-scripts/net.modules.d/helpers.d/pppd-wrapper
deleted file mode 100644
index 0cf23fd..0000000
--- a/net-scripts/net.modules.d/helpers.d/pppd-wrapper
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2005-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-action="$1"
-interface="$2"
-export IN_BACKGROUND="true"
-
-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
-RC_QUIET_STDOUT="yes"
-
-source "${svclib}/net.modules.d/helpers.d/module-loader"
-resolv="${statedir}/${interface}/resolv.conf"
-
-if [[ ${action} == "up" ]] ; then
- if [[ -n ${DNS1} || -n ${DNS2} ]] ; then
- echo "# Generated by pppd for interface $1" > "${resolv}"
- chmod 0644 "${resolv}"
- [ -n ${DNS1} ] && echo "nameserver ${DNS1}" >> "${resolv}"
- [ -n ${DNS2} ] && echo "nameserver ${DNS2}" >> "${resolv}"
- fi
-
- # Calculate the metric for our routes
- ifvar="$(bash_variable "${interface}")"
- metric="metric_${ifvar}"
- metric="${!metric}"
- if [[ -z ${metric} ]] ; then
- if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then
- metric="$(calculate_metric "${interface}")"
- else
- metric="0"
- fi
- fi
-
- [[ ${metric} != "0" ]] && interface_route_metric "${interface}" "${metric}"
-
- if service_inactive "net.${interface}" ; then
- export RC_INTERFACE_KEEP_CONFIG="yes"
- /etc/init.d/net."${interface}" start
- fi
-else
- /etc/init.d/net."${interface}" stop
-fi
-
-# vim: ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/pump-wrapper b/net-scripts/net.modules.d/helpers.d/pump-wrapper
deleted file mode 100755
index 60d1357..0000000
--- a/net-scripts/net.modules.d/helpers.d/pump-wrapper
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2005-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-[[ $1 == "renewal" ]] && exit 0
-
-action="$1"
-interface="$2"
-
-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
-RC_QUIET_STDOUT="yes"
-
-if [[ ${action} == "up" ]] ; then
- source "${svclib}/net.modules.d/helpers.d/module-loader"
-
- # Map MAC address variables to interface variables
- macnet_pre_start "${interface}"
-
- # Map wireless ESSID variables to interface variables
- if [[ -n ${wireless_module} ]] ; then
- if wireless_exists "${interface}" ; then
- essidnet_pre_start "${interface}"
- fi
- fi
-
- system_dns_extra "${interface}" "${statedir}/${interface}/resolv.conf"
-fi
-
-source "${svclib}/net.modules.d/helpers.d/dhcp-state"
-
-# vim: ts=4 :
diff --git a/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper b/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper
deleted file mode 100755
index e63f7ee..0000000
--- a/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2004-2006 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# Contributed by Roy Marples (uberlord@gentoo.org)
-
-# Map the dns, ntp and nis info so our system module can apply the setup
-
-export dns_domain_${interface}="${domain}"
-export dns_servers_${interface}="${dns}"
-export routers="${router}"
-
-export ntp_servers_${interface}="${ntpsrv}"
-
-export nis_domain_${interface}="${nisdomain}"
-export nis_servers_${interface}="${nissrv}"
-
-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
-RC_QUIET_STDOUT="yes"
-
-"${svclib}/net.modules.d/helpers.d/dhcp" "$@"
-
-if [[ $? == 0 ]] && [[ $1 == "bound" || $1 == "renew" ]] ; then
- # Store the address in a cache for future usage
- echo "${ip// /}" > "/var/cache/udhcpc-${interface}.lease"
- chmod 600 "/var/cache/udhcpc-${interface}.lease"
-fi
-
-# vim: ts=4 :
diff --git a/net-scripts/net.modules.d/adsl.sh b/net-scripts/net/adsl.sh
index 2e1423b..2e1423b 100644
--- a/net-scripts/net.modules.d/adsl.sh
+++ b/net-scripts/net/adsl.sh
diff --git a/net-scripts/net.modules.d/apipa.sh b/net-scripts/net/apipa.sh
index 5ccdc18..5ccdc18 100644
--- a/net-scripts/net.modules.d/apipa.sh
+++ b/net-scripts/net/apipa.sh
diff --git a/net-scripts/net.modules.d/arping.sh b/net-scripts/net/arping.sh
index e17df59..e889ca1 100644
--- a/net-scripts/net.modules.d/arping.sh
+++ b/net-scripts/net/arping.sh
@@ -36,6 +36,7 @@ arping_address_exists() {
[[ ${address} == "0.0.0.0" || ${address} == "0" ]] && return 1
# We need to bring the interface up to test
+ interface_exists "${iface}" || return 1
interface_up "${iface}"
if [[ -x /sbin/arping ]] ; then
@@ -62,7 +63,7 @@ arping_start() {
einfo "Pinging gateways on ${iface} for configuration"
gateways="gateways_${ifvar}[@]"
- if [[ -z ${!gateways} ]] ; then
+ if [[ -z "${!gateways}" ]] ; then
eerror "No gateways have been defined (gateways_${ifvar}=\"...\")"
return 1
fi
diff --git a/net-scripts/net.modules.d/bonding.sh b/net-scripts/net/bonding.sh
index 2b8a086..2b8a086 100644
--- a/net-scripts/net.modules.d/bonding.sh
+++ b/net-scripts/net/bonding.sh
diff --git a/net-scripts/net/br2684ctl.sh b/net-scripts/net/br2684ctl.sh
new file mode 100644
index 0000000..445d2f1
--- /dev/null
+++ b/net-scripts/net/br2684ctl.sh
@@ -0,0 +1,66 @@
+# Copyright (c) 2004-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+# void br2684ctl_depend(void)
+br2684ctl_depend() {
+ before ppp
+}
+br2684ctl_expose() {
+ variables br2684ctl
+}
+
+# bool br2684ctl_check_installed(void)
+br2684ctl_check_installed() {
+ [[ -x /sbin/br2684ctl ]] && return 0
+ ${1:-false} && eerror "For RFC 2684 Bridge control support, emerge net-misc/br2684ctl"
+ return 1
+}
+
+# bool br2684ctl_start(char *iface)
+br2684ctl_pre_start() {
+ local iface="$1" ifvar="$(bash_variable "$1")" opts=
+ local number="${iface#${iface%%[0-9]}}"
+
+ opts="br2684ctl_${ifvar}"
+ [[ -z ${!opts} ]] && return 0
+
+ if [[ $(interface_type "${iface}") != "nas" || -z ${number} ]] ; then
+ eerror "interface must be called nas[0-9] for RFC 2684 Bridging"
+ return 1
+ fi
+
+ if [[ " ${!opts} " != *" -a "* ]] ; then
+ eerror "-a option (VPI and VCI) is required in br2684_ctl"
+ return 1
+ fi
+
+ if [[ " ${!opts} " != *" -b "* ]] ; then
+ eerror "The -b option is not allowed for br2684ctl_${ifvar}"
+ return 1
+ fi
+
+ einfo "Starting RFC 2684 Bridge control on ${iface}"
+
+ start-stop-daemon --start --exec /sbin/br2684ctl --background \
+ --make-pidfile --pidfile "/var/run/br2684ctl-${iface}.pid" \
+ -- ${!opts} -c "${number}"
+ eend $?
+}
+
+# bool br2684ctl_post_stop(char *iface)
+br2684ctl_post_stop() {
+ local iface="$1"
+ local number="${iface#${iface%%[0-9]}}"
+
+ [[ $(itype "${iface}") != "nas" ]] && return 0
+
+ [[ -e /var/run/br2864ctl-${iface}.pid ]] || return 0
+
+ einfo "Stopping RFC 2684 Bridge control on ${iface}"
+ start-stop-daemon --stop --exec /sbin/br2864ctl \
+ --pidfile "/var/run/br2684ctl-${iface}.pid"
+ eend $?
+}
+
+# vim: set ts=4 :
diff --git a/net-scripts/net.modules.d/bridge.sh b/net-scripts/net/bridge.sh
index 67af002..67af002 100644
--- a/net-scripts/net.modules.d/bridge.sh
+++ b/net-scripts/net/bridge.sh
diff --git a/net-scripts/net/ccwgroup.sh b/net-scripts/net/ccwgroup.sh
new file mode 100644
index 0000000..3eca965
--- /dev/null
+++ b/net-scripts/net/ccwgroup.sh
@@ -0,0 +1,55 @@
+# Copyright (c) 2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Contributed by Roy Marples (uberlord@gentoo.org)
+
+ccwgroup_depend() {
+ before interface
+}
+ccwgroup_expose() {
+ variables ccwgroup
+}
+
+ccwgroup_pre_start() {
+ local iface="$1" ifvar="$(bash_variable "$1")"
+ local ccw="ccwgroup_${ifvar}[@]"
+ local -a ccwgroup=( "${!ccw}" )
+
+ [[ -z ${!ccw} ]] && return 0
+ if [[ ! -d /sys/bus/ccwgroup ]] ; then
+ eerror "ccwgroup support missing in kernel"
+ return 1
+ fi
+
+ einfo "Enabling ccwgroup on ${iface}"
+ echo "${!ccw// /,}" > /sys/bus/ccwgroup/drivers/qeth/group
+ echo "1" > /sys/devices/qeth/"${ccwgroup[0]}"/online
+ eend $?
+}
+
+ccwgroup_pre_stop() {
+ local iface="$1"
+
+ # Erase any existing ccwgroup to be safe
+ save_options ccwgroup_device ""
+
+ [[ ! -L /sys/class/net/"${iface}"/driver ]] && return 0
+ local driver="$(readlink /sys/class/net/"${iface}"/driver)"
+ [[ ${driver} != *"/bus/ccwgroup/"* ]] && return 0
+
+ local device="$(readlink /sys/class/net/"${iface}"/device)"
+ device="${device##*/}"
+ save_options ccwgroup_device "${device}"
+}
+
+ccwgroup_post_stop() {
+ local iface="$1" device="$(get_options ccwgroup_device)"
+
+ [[ -z ${device} ]] && return 0
+
+ einfo "Disabling ccwgroup on ${iface}"
+ echo "0" > /sys/devices/qeth/"${device}"/online
+ echo "1" > /sys/devices/qeth/"${device}"/ungroup
+ eend $?
+}
+
+# vim: set ts=4 :
diff --git a/net-scripts/net.modules.d/dhclient.sh b/net-scripts/net/dhclient.sh
index 6514224..81644ac 100644
--- a/net-scripts/net.modules.d/dhclient.sh
+++ b/net-scripts/net/dhclient.sh
@@ -73,6 +73,11 @@ dhclient_start() {
[[ -z ${!d} ]] && d="dhcp"
# Add our peer and metric options
+ if [[ " ${!d} " == *" nogateway "* ]] ; then
+ opts="${opts} -e PEER_ROUTERS=no"
+ elif [[ " ${opts} " != *" -e PEER_ROUTERS="* ]] ; then
+ opts="${opts} -e PEER_ROUTERS=yes"
+ fi
if [[ " ${!d} " == *" nodns "* ]] ; then
opts="${opts} -e PEER_DNS=no"
elif [[ " ${opts} " != *" -e PEER_DNS="* ]] ; then
diff --git a/net-scripts/net.modules.d/dhcpcd.sh b/net-scripts/net/dhcpcd.sh
index 2311386..3cf6267 100644
--- a/net-scripts/net.modules.d/dhcpcd.sh
+++ b/net-scripts/net/dhcpcd.sh
@@ -86,7 +86,7 @@ dhcpcd_start() {
[[ ${d} == *" nonis "* ]] && opts="${opts} -Y"
[[ ${d} == *" nogateway "* ]] && opts="${opts} -G"
- # We transmit the hostname by default:q
+ # We transmit the hostname by default
if [[ " ${d} " != *" nosendhost "* && " ${opts} " != *" -h "* ]]; then
local hname="$(hostname)"
[[ -n ${hname} && ${hname} != "(none)" && ${hname} != "localhost" ]] \
diff --git a/net-scripts/net.modules.d/essidnet.sh b/net-scripts/net/essidnet.sh
index 689a6ea..689a6ea 100644
--- a/net-scripts/net.modules.d/essidnet.sh
+++ b/net-scripts/net/essidnet.sh
diff --git a/net-scripts/net.modules.d/ifconfig.sh b/net-scripts/net/ifconfig.sh
index 4f7b82c..6ced9e2 100644
--- a/net-scripts/net.modules.d/ifconfig.sh
+++ b/net-scripts/net/ifconfig.sh
@@ -109,7 +109,7 @@ ifconfig_down() {
ifconfig_is_up() {
local check="\<UP\>" addr="${2:-false}"
${addr} && check="\<inet addr:.*${check}"
- ifconfig "$1" | grep -Eq "${check}" && return 0
+ ifconfig "$1" | tr '\n' ' ' | grep -Eq "${check}" && return 0
return 1
}
diff --git a/net-scripts/net.modules.d/ifplugd.sh b/net-scripts/net/ifplugd.sh
index 110b443..110b443 100644
--- a/net-scripts/net.modules.d/ifplugd.sh
+++ b/net-scripts/net/ifplugd.sh
diff --git a/net-scripts/net.modules.d/ip6to4.sh b/net-scripts/net/ip6to4.sh
index cd3f1f6..cd3f1f6 100644
--- a/net-scripts/net.modules.d/ip6to4.sh
+++ b/net-scripts/net/ip6to4.sh
diff --git a/net-scripts/net.modules.d/ipppd.sh b/net-scripts/net/ipppd.sh
index 943f558..943f558 100644
--- a/net-scripts/net.modules.d/ipppd.sh
+++ b/net-scripts/net/ipppd.sh
diff --git a/net-scripts/net.modules.d/iproute2.sh b/net-scripts/net/iproute2.sh
index f600704..f600704 100644
--- a/net-scripts/net.modules.d/iproute2.sh
+++ b/net-scripts/net/iproute2.sh
diff --git a/net-scripts/net.modules.d/iptunnel.sh b/net-scripts/net/iptunnel.sh
index 3a3568d..3a3568d 100644
--- a/net-scripts/net.modules.d/iptunnel.sh
+++ b/net-scripts/net/iptunnel.sh
diff --git a/net-scripts/net.modules.d/iwconfig.sh b/net-scripts/net/iwconfig.sh
index 6cca973..6cca973 100644
--- a/net-scripts/net.modules.d/iwconfig.sh
+++ b/net-scripts/net/iwconfig.sh
diff --git a/net-scripts/net.modules.d/macchanger.sh b/net-scripts/net/macchanger.sh
index 6331997..6331997 100644
--- a/net-scripts/net.modules.d/macchanger.sh
+++ b/net-scripts/net/macchanger.sh
diff --git a/net-scripts/net.modules.d/macnet.sh b/net-scripts/net/macnet.sh
index 86a3453..86a3453 100644
--- a/net-scripts/net.modules.d/macnet.sh
+++ b/net-scripts/net/macnet.sh
diff --git a/net-scripts/net.modules.d/netplugd.sh b/net-scripts/net/netplugd.sh
index f0dfdb7..f0dfdb7 100644
--- a/net-scripts/net.modules.d/netplugd.sh
+++ b/net-scripts/net/netplugd.sh
diff --git a/net-scripts/net.modules.d/pppd.sh b/net-scripts/net/pppd.sh
index df5cbd2..feb74d4 100644
--- a/net-scripts/net.modules.d/pppd.sh
+++ b/net-scripts/net/pppd.sh
@@ -1,6 +1,8 @@
# Copyright (c) 2005-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+# Contributed by Alin Nastac (mrness@gentoo.org)
+
# void pppd_depend(void)
#
# Sets up the dependancies for the module
diff --git a/net-scripts/net.modules.d/pump.sh b/net-scripts/net/pump.sh
index 51fc6ad..51fc6ad 100644
--- a/net-scripts/net.modules.d/pump.sh
+++ b/net-scripts/net/pump.sh
diff --git a/net-scripts/net.modules.d/rename.sh b/net-scripts/net/rename.sh
index f3de442..f3de442 100644
--- a/net-scripts/net.modules.d/rename.sh
+++ b/net-scripts/net/rename.sh
diff --git a/net-scripts/net.modules.d/system.sh b/net-scripts/net/system.sh
index c32bb74..c32bb74 100644
--- a/net-scripts/net.modules.d/system.sh
+++ b/net-scripts/net/system.sh
diff --git a/net-scripts/net.modules.d/tuntap.sh b/net-scripts/net/tuntap.sh
index 597cb12..597cb12 100644
--- a/net-scripts/net.modules.d/tuntap.sh
+++ b/net-scripts/net/tuntap.sh
diff --git a/net-scripts/net.modules.d/udhcpc.sh b/net-scripts/net/udhcpc.sh
index 07ab6cf..6fc1a19 100644
--- a/net-scripts/net.modules.d/udhcpc.sh
+++ b/net-scripts/net/udhcpc.sh
@@ -90,28 +90,26 @@ udhcpc_start() {
fi
# Setup options for the udhcpc script
- # We pass these via a seperate config file so we're nice and fast
- # maybe oneday, udhcp will accept custom env vars.
- local conf="/var/run/udhcpc-${iface}.conf"
- echo "# udhcpc runtime configuration for interface ${iface}" > "${conf}"
+ # This requires a specfic Gentoo patch to udhcp which will not be
+ # accepted upstream.
+ if [[ " ${!d} " == *" nogateway "* ]] ; then
+ opts="${opts} --env PEER_ROUTERS=no"
+ else
+ opts="${opts} --env PEER_ROUTERS=yes"
+ fi
if [[ " ${!d} " == *" nodns "* ]] ; then
- #opts="${opts} --env PEER_DNS=no"
- echo "PEER_DNS=no" >> "${conf}"
+ opts="${opts} --env PEER_DNS=no"
else
- #opts="${opts} --env PEER_DNS=yes"
- echo "PEER_DNS=yes" >> "${conf}"
+ opts="${opts} --env PEER_DNS=yes"
fi
if [[ " ${!d} " == *" nontp "* ]] ; then
- #opts="${opts} --env PEER_NTP=no"
- echo "PEER_NTP=no" >> "${conf}"
+ opts="${opts} --env PEER_NTP=no"
else
- #opts="${opts} --env PEER_NTP=yes"
- echo "PEER_NTP=yes" >> "${conf}"
+ opts="${opts} --env PEER_NTP=yes"
fi
local metric="metric_${ifvar}"
if [[ -n ${!metric} ]] ; then
- #opts="${opts} --env IF_METRIC=${!metric}"
- echo "IF_METRIC=${!metric}" >> "${conf}"
+ opts="${opts} --env IF_METRIC=${!metric}"
fi
# Bring up DHCP for this interface (or alias)
@@ -126,9 +124,15 @@ udhcpc_start() {
fi
fi
- eval start-stop-daemon --start --exec /sbin/udhcpc \
- --pidfile "${pidfile}" \
- -- "${opts}" --interface="${iface}" --now \
+ # Don't use s-s-d if the user wants to quit on lease.
+ if [[ " ${opts} " == *" -q "* || " ${opts} " == *" --quit "* ]]; then
+ x="/sbin/udhcpc"
+ else
+ x="start-stop-daemon --start --exec /sbin/udhcpc \
+ --pidfile \"${pidfile}\" --"
+ fi
+
+ eval "${x}" "${opts}" --interface="${iface}" --now \
--script=/lib/rcscripts/sh/udhcpc.sh \
--pidfile="${pidfile}" >/dev/null
eend $? || return 1
diff --git a/net-scripts/net.modules.d/vlan.sh b/net-scripts/net/vlan.sh
index e7f0735..f6c1e26 100644
--- a/net-scripts/net.modules.d/vlan.sh
+++ b/net-scripts/net/vlan.sh
@@ -98,9 +98,9 @@ vlan_pre_start() {
#
# Always returns 0 (true)
vlan_post_start() {
- local iface="$1" vlan vlans vlans_old e ifname ifvar="$(bash_variable "$1")"
-
+ local iface="$1" vlan vlans vlans_old ifname ifvar="$(bash_variable "$1")"
vlans="vlans_${ifvar}[@]"
+ local start="vlan_start_${ifvar}"
# BACKWARD COMPATIBILITY: check for old vlan variable name
vlans_old="iface_${ifvar}_vlans"
@@ -121,6 +121,11 @@ vlan_post_start() {
fi
eend 0
+ # We may not want to start the vlan ourselves, but
+ # as a seperate init script. This allows the vlan to be
+ # renamed if needed.
+ [[ -n ${!start} && ${!start} != "yes" ]] && continue
+
# We need to work out the interface name of our new vlan id
ifname="$( \
sed -n -e 's/^\([^ \t]*\) *| '"${vlan}"' *| .*'"${iface}"'$/\1/p' \
diff --git a/net-scripts/net.modules.d/wpa_supplicant.sh b/net-scripts/net/wpa_supplicant.sh
index a9e99c0..1f54548 100644
--- a/net-scripts/net.modules.d/wpa_supplicant.sh
+++ b/net-scripts/net/wpa_supplicant.sh
@@ -89,12 +89,20 @@ wpa_supplicant_get_ap_mac_address() {
# correct encryption keys
wpa_supplicant_associated() {
local -a status
- eval status=( $( wpa_cli -i"$1" status | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\"\2\"/p' ) )
+ eval status=( $(wpa_cli -i"$1" status \
+ | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\"\2\"/p')
+ )
case "${status[0]}" in
- "NONE") [[ ${status[1]} == "ASSOCIATED" || ${status[1]} == "COMPLETED" ]] ;;
- "IEEE 802.1X (no WPA)") [[ ${status[2]} == "SUCCESS" ]] ;;
- *) [[ ${status[1]} == "COMPLETED" ]] ;;
+ "NONE")
+ [[ ${status[1]} == "ASSOCIATED" || ${status[1]} == "COMPLETED" ]]
+ ;;
+ "IEEE 802.1X (no WPA)")
+ [[ ${status[2]} == "SUCCESS" ]]
+ ;;
+ *)
+ [[ ${status[1]} == "COMPLETED" ]]
+ ;;
esac
return $?
@@ -148,6 +156,8 @@ wpa_supplicant_associate() {
[[ -z ${!timeout} ]] && timeout="wpa_timeout_${ifvar}"
timeout="${!timeout:--1}"
+ [[ -z ${actfile} && ${timeout} -lt 0 ]] && timeout="60"
+
if [[ ${timeout} == "0" ]] ; then
ewarn "WARNING: infinite timeout set for association on ${iface}"
elif [[ ${timeout} -lt 0 ]] ; then
@@ -176,6 +186,7 @@ wpa_supplicant_associate() {
if [[ -n ${actfile} ]] ; then
eend 1 "Failed to configure ${iface} in the background"
else
+
eend 1 "Timed out"
fi
@@ -278,27 +289,22 @@ wpa_supplicant_pre_start() {
# Some drivers require the interface to be up
interface_up "${iface}"
- version="$( wpa_cli -v | sed -n -e 's/wpa_cli v//p' )"
- version=( ${version//./ } )
- (( version = version[0] * 1000 + version[1] * 100 + version[2] ))
-
# wpa_supplicant 0.4.0 and greater supports wpa_cli actions
# This is very handy as if and when different association mechanisms are
# introduced to wpa_supplicant we don't have to recode for them as
# wpa_cli is now responsible for informing us of success/failure.
# The downside of this is that we don't see the interface being configured
# for DHCP/static.
- if [[ ${version} -gt 399 ]] ; then
- opts="${opts} -W -P/var/run/wpa_supplicant-${iface}.pid"
- actfile="/etc/wpa_supplicant/wpa_cli.sh"
- # Support old file location
- [[ ! -x ${actfile} ]] && actfile="/sbin/wpa_cli.action"
- [[ ! -x ${actfile} ]] && unset actfile
- fi
+ actfile="/etc/wpa_supplicant/wpa_cli.sh"
+ # Support old file location
+ [[ ! -x ${actfile} ]] && actfile="/sbin/wpa_cli.action"
+ [[ ! -x ${actfile} ]] && unset actfile
+ [[ -n ${actfile} ]] && opts="${opts} -W"
eval start-stop-daemon --start --exec /sbin/wpa_supplicant \
--pidfile "/var/run/wpa_supplicant-${iface}.pid" \
- -- "${opts}" -B -i"${iface}"
+ -- "${opts}" -B -i"${iface}" \
+ -P"/var/run/wpa_supplicant-${iface}.pid"
eend "$?" || return 1
# Starting wpa_supplication-0.4.0, we can get wpa_cli to
@@ -327,7 +333,7 @@ wpa_supplicant_pre_start() {
save_options "ESSID" "${ESSID}"
local -a status
- eval status=( $( wpa_cli -i"${iface}" status | sed -n -e 's/^\(bssid\|pairwise_cipher\|key_mgmt\)=\([^=]\+\).*/\"\U\2\"/p' | tr '[:lower:]' '[:upper:]' ) )
+ eval status=( $(wpa_cli -i"${iface}" status | sed -n -e 's/^\(bssid\|pairwise_cipher\|key_mgmt\)=\([^=]\+\).*/\"\U\2\"/p' | tr '[:lower:]' '[:upper:]') )
einfo "${iface} connected to \"${ESSID//\\\\/\\\\}\" at ${status[0]}"
if [[ ${status[2]} == "NONE" ]] ; then
@@ -345,7 +351,7 @@ wpa_supplicant_pre_start() {
fi
if [[ -n ${actfile} ]] ; then
- local addr="$( interface_get_address "${iface}" )"
+ local addr="$(interface_get_address "${iface}")"
einfo "${iface} configured with address ${addr}"
exit 0
fi
diff --git a/sbin/depscan.sh b/sbin/depscan.sh
index ed16100..e9454a1 100755
--- a/sbin/depscan.sh
+++ b/sbin/depscan.sh
@@ -1,9 +1,37 @@
#!/bin/bash
-# Copyright 1999-2004 Gentoo Foundation
+# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-source /sbin/functions.sh
-mysvcdir="${svcdir}"
+if [[ ${BOOT} == "yes" ]] ; then
+ trap ":" INT QUIT TSTP
+fi
+
+argv0=${0##*/}
+source /etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+}
+esyslog() { :; }
+
+usage() {
+ cat <<-EOF
+ Usage: ${argv0} [options]
+
+ Rebuild Gentoo init.d service dependency tree.
+
+ Options:
+ -d, --debug Turn on debug output
+ -s, --svcdir Specify svcdir (default: ${svcdir})
+ -u, --update Force update even if mtimes are OK
+ -h, --help Show this help cruft
+ EOF
+ [[ -z $@ ]] && exit 0
+ echo
+ eerror "$*"
+ exit 1
+}
+
+mysvcdir=${svcdir}
update=false
while [[ -n $1 ]] ; do
@@ -22,6 +50,12 @@ while [[ -n $1 ]] ; do
--update|-u)
update=true
;;
+ --help|-h)
+ usage
+ ;;
+ *)
+ usage "Invalid option '$1'"
+ ;;
esac
shift
done
@@ -44,14 +78,14 @@ done
# Only update if files have actually changed
if ! ${update} ; then
- clock_screw=false
+ clock_screw=0
mtime_test="${mysvcdir}/mtime-test.$$"
# If its not there, we have to update, and make sure its present
# for next mtime testing
if [[ ! -e "${mysvcdir}/depcache" ]] ; then
- update=true
- touch "${mysvcdir}/depcache"
+ update=true
+ touch "${mysvcdir}/depcache"
fi
touch "${mtime_test}"
@@ -61,12 +95,14 @@ if ! ${update} ; then
&& is_older_than "${mysvcdir}/depcache" "${config}" \
&& update=true
- is_older_than "${mtime_test}" "${config}" && clock_screw=true
+ is_older_than "${mtime_test}" "${config}" && clock_screw=1
done
rm -f "${mtime_test}"
- ${clock_screw} && \
- ewarn "Some file in '/etc/{conf.d,init.d}' have Modification time in the future!"
+ if [[ ${clock_screw} == 1 ]] ; then
+ ewarn "One of the files in /etc/{conf.d,init.d} or /etc/rc.conf"
+ ewarn "has a modification time in the future!"
+ fi
shift
fi
@@ -75,7 +111,7 @@ fi
ebegin "Caching service dependencies"
-# Clean out the non volitile directories ...
+# Clean out the non volatile directories ...
rm -rf "${mysvcdir}"/dep{cache,tree} "${mysvcdir}"/{broken,snapshot}/*
retval=0
diff --git a/sbin/rc-daemon.sh b/sbin/rc-daemon.sh
index 3d89447..f0b3dca 100755
--- a/sbin/rc-daemon.sh
+++ b/sbin/rc-daemon.sh
@@ -378,7 +378,7 @@ start-stop-daemon() {
# We should really check for valid cmd AND pidfile
# But most called to --stop only set the pidfile
if [[ ${RC_DAEMONS[i]} == "{cmd}" \
- || ${RC_PIDFILES[i]}="${pidfile}" ]]; then
+ || ${RC_PIDFILES[i]} == "${pidfile}" ]]; then
unset RC_DAEMONS[i] RC_PIDFILES[i]
RC_DAEMONS=( "${RC_DAEMONS[@]}" )
RC_PIDFILES=( "${RC_PIDFILES[@]}" )
diff --git a/sbin/rc-services.sh b/sbin/rc-services.sh
index df0b557..25e1805 100755
--- a/sbin/rc-services.sh
+++ b/sbin/rc-services.sh
@@ -745,8 +745,8 @@ valid_iafter() {
# Get and sort the dependencies of given service[s].
#
trace_dependencies() {
- local -a services=( "$@" ) net_deps
- local i j net_services x
+ local -a services=( "$@" ) net_deps=()
+ local i= j= net_services= x=
if [[ $1 == -* ]]; then
deptype="${1/-/}"
@@ -757,26 +757,16 @@ trace_dependencies() {
fi
fi
- net_services="$( cd "${svcdir}"/started; ls net.* 2>/dev/null )"
- # If no net services are running or we only have net.lo up, then
- # assume we are in boot runlevel or starting a new runlevel
- if [[ -z ${net_services} || ${net_services} == "net.lo" ]]; then
- get_net_services() {
- local runlevel="$1"
-
- if [[ -d "/etc/runlevels/${runlevel}" ]] ; then
- cd "/etc/runlevels/${runlevel}"
- ls net.* 2>/dev/null
- fi
- }
-
- local mylevel="${BOOTLEVEL}"
- local x="$( get_net_services "${mylevel}" )"
-
- [[ -f "${svcdir}/softlevel" ]] && mylevel="$( < "${svcdir}/softlevel" )"
- [[ ${BOOTLEVEL} != "${mylevel}" ]] && \
- local x="${x} $( get_net_services "${mylevel}" )"
- [[ -n ${x} ]] && net_services="${x}"
+ if is_runlevel_stop ; then
+ for x in $(dolisting "${svcdir}/started/net.*") \
+ $(dolisting "${svcdir}/inactive/net.*") ; do
+ net_services="${net_services} ${x##*/}"
+ done
+ elif is_runlevel_start || ! is_net_up ; then
+ for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \
+ $(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") ; do
+ net_services="${net_services} ${x##*/}"
+ done
fi
# Cache the generic "net" depends
diff --git a/sbin/rc-update b/sbin/rc-update
index a1864a9..28bf91e 100755
--- a/sbin/rc-update
+++ b/sbin/rc-update
@@ -11,7 +11,7 @@ usage() {
cat << FOO
usage: ${argv0} -a|add script runlevel1 [runlevel2 ...]
${argv0} -d|del script [runlevel1 ...]
- ${argv0} -s|show [runlevel1 ...]
+ ${argv0} -s|show [-v|--verbose] [runlevel1 ...]
examples:
# ${argv0} add net.eth0 default
@@ -28,8 +28,8 @@ examples:
/etc/runlevels/default and /etc/runlevels/wumpus.
# ${argv0} show
- Show all the available scripts and list at which runlevels they
- will execute.
+ Show all enabled scripts and list at which runlevels they will
+ execute. Run with --verbose to see all available scripts.
FOO
exit ${1:-0}
}
diff --git a/sbin/runscript.sh b/sbin/runscript.sh
index 558aff3..9614529 100755
--- a/sbin/runscript.sh
+++ b/sbin/runscript.sh
@@ -27,6 +27,14 @@ myservice="${SVCNAME}"
# until after rc sysinit has completed so we punt them to the boot runlevel
if [[ -e /dev/.rcsysinit ]] ; then
eerror "ERROR: cannot run ${SVCNAME} until sysinit completes"
+ [[ ${RC_COLDPLUG} == "no" ]] && exit 1
+ if [[ ${RC_COLDPLUG} != "yes" ]] ; then
+ for x in ${RC_COLDPLUG} ; do
+ # We don't quote ${x} so we can do globbing
+ [[ ${SVCNAME} == ${x} ]] && break
+ [[ "!${SVCNAME}" == ${x} ]] && exit 1
+ done
+ fi
eerror "${SVCNAME} will be started in the ${BOOTLEVEL} runlevel"
if [[ ! -L /dev/.rcboot/"${SVCNAME}" ]] ; then
[[ ! -d /dev/.rcboot ]] && mkdir /dev/.rcboot
diff --git a/src/Makefile b/src/Makefile
index f27a57a..214a0b2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,11 +1,10 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header$
CC = gcc
LD = gcc
-CFLAGS = -Wall -O2
+CFLAGS ?= -Wall -O2
DESTDIR =
LIBDIR = lib
diff --git a/tarball.sh b/tarball.sh
index ce21999..2c48320 100755
--- a/tarball.sh
+++ b/tarball.sh
@@ -30,7 +30,7 @@ done
# copy net-scripts and remove older stuff
install -d -m0755 ${DEST}/lib/rcscripts
cp -ax net-scripts/init.d ${DEST}
-cp -ax net-scripts/net.modules.d ${DEST}/lib/rcscripts
+cp -ax net-scripts/net ${DEST}/lib/rcscripts
cp -ax net-scripts/conf.d ${DEST}/etc
ln -sfn net.lo ${DEST}/init.d/net.eth0