diff options
author | Christian Heim <phreak@gentoo.org> | 2006-03-11 13:39:43 +0000 |
---|---|---|
committer | Christian Heim <phreak@gentoo.org> | 2006-03-11 13:39:43 +0000 |
commit | fc761e814c3565597787ef2a8abe2b56e2d5f097 (patch) | |
tree | 456a0bc48a04b63768b5b4eb104ed32780a72df5 | |
parent | Merging r1939 (diff) | |
download | baselayout-vserver-fc761e814c3565597787ef2a8abe2b56e2d5f097.tar.gz baselayout-vserver-fc761e814c3565597787ef2a8abe2b56e2d5f097.tar.bz2 baselayout-vserver-fc761e814c3565597787ef2a8abe2b56e2d5f097.zip |
Merging r1943
svn path=/baselayout-vserver/trunk/; revision=278
38 files changed, 312 insertions, 193 deletions
@@ -5,10 +5,15 @@ Give a better error message when no valid DHCP client is installed. - 07 Mar 2006; Roy Marples <uberlord@gentoo.org>: + 10 Mar 2006; Roy Marples <uberlord@gentoo.org>: - Set essid to "" instead of -- off as it appears not all drivers work - as they should. Hopefully fixes #125067 and maybe #120822. + iwconfig now reports mode in scan results + + net script modules variables function has been moved into module_expose + and removed from module_depend to be more correct. + + net script modules have had #!/bin/bash removed from the top and now + set vim fs=sh to be more correct. 06 Mar 2006; Mike Frysinger <vapier@gentoo.org>: diff --git a/ChangeLog.vserver b/ChangeLog.vserver index 4e88676..5b0a27c 100644 --- a/ChangeLog.vserver +++ b/ChangeLog.vserver @@ -1,6 +1,50 @@ # ChangeLog for Gentoo System Intialization ("rc") scripts # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2 + 11 Mar 2006; Christian Heim <phreak@gentoo.org>: + Merging latest changes to the rc-scripts branch. This merge is based + upon revision 1943. + + ChangeLog | 11 ++- + ChangeLog.vserver | 44 +++++++++++++ + net-scripts/init.d/net.lo | 5 + + net-scripts/net.modules.d/adsl | 4 - + net-scripts/net.modules.d/apipa | 5 - + net-scripts/net.modules.d/arping | 4 - + net-scripts/net.modules.d/bonding | 10 ++- + net-scripts/net.modules.d/bridge | 10 ++- + net-scripts/net.modules.d/dhclient | 10 ++- + net-scripts/net.modules.d/dhcpcd | 9 ++ + net-scripts/net.modules.d/essidnet | 4 - + net-scripts/net.modules.d/helpers.d/dhclient-wrapper | 11 +-- + net-scripts/net.modules.d/helpers.d/dhcp | 34 +++++----- + net-scripts/net.modules.d/helpers.d/dhcp-state | 20 +++--- + net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper | 14 ++-- + net-scripts/net.modules.d/helpers.d/functions | 4 - + net-scripts/net.modules.d/helpers.d/module-loader | 34 +++------- + net-scripts/net.modules.d/helpers.d/pppd-wrapper | 10 +-- + net-scripts/net.modules.d/helpers.d/pump-wrapper | 14 ++-- + net-scripts/net.modules.d/helpers.d/udhcpc-wrapper | 9 +- + net-scripts/net.modules.d/ifconfig | 12 ++- + net-scripts/net.modules.d/ifplugd | 13 ++-- + net-scripts/net.modules.d/ip6to4 | 7 ++ + net-scripts/net.modules.d/ipppd | 3 + net-scripts/net.modules.d/iproute2 | 13 ++-- + net-scripts/net.modules.d/iptunnel | 12 ++- + net-scripts/net.modules.d/iwconfig | 58 ++++++++---------- + net-scripts/net.modules.d/macchanger | 12 ++- + net-scripts/net.modules.d/macnet | 6 - + net-scripts/net.modules.d/netplugd | 13 ++-- + net-scripts/net.modules.d/pppd | 5 - + net-scripts/net.modules.d/pump | 12 ++- + net-scripts/net.modules.d/rename | 12 ++- + net-scripts/net.modules.d/system | 12 ++- + net-scripts/net.modules.d/tuntap | 12 ++- + net-scripts/net.modules.d/udhcpc | 12 ++- + net-scripts/net.modules.d/vlan | 14 ++-- + net-scripts/net.modules.d/wpa_supplicant | 11 ++- + 38 files changed, 312 insertions(+), 193 deletions(-) + 09 Mar 2006; Christian Heim <phreak@gentoo.org>: Merging latest changes to the rc-scripts branch. This merge is based upon revision 1939. diff --git a/net-scripts/init.d/net.lo b/net-scripts/init.d/net.lo index 028f8c7..0ee6262 100755 --- a/net-scripts/init.d/net.lo +++ b/net-scripts/init.d/net.lo @@ -437,6 +437,11 @@ modules_load() { MODULE="${MODULES[i]}" ${MODULE}_depend + # expose does exactly the same thing as depend + # However it is more "correct" as it exposes things to other modules + # instead of depending on them ;) + is_function "${MODULES[i]}_expose" && ${MODULES[i]}_expose + # If no provide is given, assume module name if is_function "${MODULES[i]}_provide" ; then PROVIDES[i]="$(${MODULES[i]}_provide)" diff --git a/net-scripts/net.modules.d/adsl b/net-scripts/net.modules.d/adsl index ffc26e6..0dcc677 100644 --- a/net-scripts/net.modules.d/adsl +++ b/net-scripts/net.modules.d/adsl @@ -1,7 +1,5 @@ -#!/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) # void adsl_depend(void) @@ -92,4 +90,4 @@ adsl_stop() { return 0 } -# vim: ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/apipa b/net-scripts/net.modules.d/apipa index 6be2858..4ebd469 100644 --- a/net-scripts/net.modules.d/apipa +++ b/net-scripts/net.modules.d/apipa @@ -1,8 +1,7 @@ -#!/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) + # void apipa_depend(void) # # Sets up the dependancies for the module @@ -44,4 +43,4 @@ apipa_start() { return 1 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/arping b/net-scripts/net.modules.d/arping index aa1da8a..1a476e7 100644 --- a/net-scripts/net.modules.d/arping +++ b/net-scripts/net.modules.d/arping @@ -1,7 +1,5 @@ -#!/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) # void arping_depend(void) @@ -108,4 +106,4 @@ arping_start() { return 1 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/bonding b/net-scripts/net.modules.d/bonding index 9aa67e0..6095c74 100644 --- a/net-scripts/net.modules.d/bonding +++ b/net-scripts/net.modules.d/bonding @@ -1,7 +1,5 @@ -#!/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) # void bonding_depend(void) @@ -11,6 +9,12 @@ bonding_depend() { before interface macchanger functions interface_exists interface_up interface_down \ interface_del_addresses +} + +# void bonding_expose(void) +# +# Expose variables that can be configured +bonding_expose() { variables slaves } @@ -113,4 +117,4 @@ bonding_stop() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/bridge b/net-scripts/net.modules.d/bridge index 8bad1f6..ec1e2ff 100644 --- a/net-scripts/net.modules.d/bridge +++ b/net-scripts/net.modules.d/bridge @@ -1,7 +1,5 @@ -#!/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) # Fix any potential localisation problems @@ -15,6 +13,12 @@ brctl() { bridge_depend() { before interface macnet functions interface_down interface_del_addresses interface_set_flag +} + +# void bridge_expose(void) +# +# Expose variables that can be configured +bridge_expose() { variables bridge bridge_add brctl } @@ -191,4 +195,4 @@ bridge_stop() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/dhclient b/net-scripts/net.modules.d/dhclient index 1483cb0..b8d3312 100644 --- a/net-scripts/net.modules.d/dhclient +++ b/net-scripts/net.modules.d/dhclient @@ -1,7 +1,5 @@ -#!/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) # Fix any potential localisation problems @@ -17,6 +15,12 @@ dhclient_depend() { after interface provide dhcp functions interface_exists interface_get_address +} + +# void dhclient_expose(void) +# +# Expose variables that can be configured +dhclient_expose() { variables dhclient dhcp } @@ -143,4 +147,4 @@ dhclient_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/dhcpcd b/net-scripts/net.modules.d/dhcpcd index 5fc64c0..516f7e3 100644 --- a/net-scripts/net.modules.d/dhcpcd +++ b/net-scripts/net.modules.d/dhcpcd @@ -1,4 +1,3 @@ -#!/bin/bash # Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -11,6 +10,12 @@ dhcpcd_depend() { after interface provide dhcp functions interface_exists interface_get_address +} + +# void dhcpcd_expose(void) +# +# Expose variables that can be configured +dhcpcd_expose() { variables dhcpcd dhcp } @@ -115,4 +120,4 @@ dhcpcd_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/essidnet b/net-scripts/net.modules.d/essidnet index 3be0bc8..69e2db5 100644 --- a/net-scripts/net.modules.d/essidnet +++ b/net-scripts/net.modules.d/essidnet @@ -1,7 +1,5 @@ -#!/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) # Many thanks to all the people in the Gentoo forums for their ideas and # motivation for me to make this and keep on improving it @@ -48,4 +46,4 @@ essidnet_pre_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/helpers.d/dhclient-wrapper b/net-scripts/net.modules.d/helpers.d/dhclient-wrapper index 7dd1154..c2d980b 100755 --- a/net-scripts/net.modules.d/helpers.d/dhclient-wrapper +++ b/net-scripts/net.modules.d/helpers.d/dhclient-wrapper @@ -1,14 +1,13 @@ #!/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 ]] \ - && ( . /etc/dhcp/dhclient-enter-hooks ) + && ( source /etc/dhcp/dhclient-enter-hooks ) case "${reason}" in BOUND|REBOOT|REBIND) action="bound" ;; @@ -37,13 +36,15 @@ export ntp_servers_${interface}="${new_domain_name_servers}" export nis_domain_${interface}="${new_nis_domain}" export nis_servers_${interface}="${new_nis_servers}" -. /sbin/functions.sh +[[ ${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 ]] \ - && ( . /etc/dhcp/dhclient-exit-hooks ) + && ( source /etc/dhcp/dhclient-exit-hooks ) exit "${result}" -# vim:ts=4 +# vim: ts=4 : diff --git a/net-scripts/net.modules.d/helpers.d/dhcp b/net-scripts/net.modules.d/helpers.d/dhcp index 6a315af..d210705 100755 --- a/net-scripts/net.modules.d/helpers.d/dhcp +++ b/net-scripts/net.modules.d/helpers.d/dhcp @@ -1,14 +1,15 @@ #!/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}" -. /sbin/functions.sh -. "${svclib}/net.modules.d/helpers.d/module-loader" +[[ ${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}" @@ -23,8 +24,10 @@ case "${action}" in service_started "${service}" && mark_service_inactive "${service}" remove_state "${interface}" if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then - best_interface="$(select_best_interface)" - apply_state "${best_interface}" + if service_inactive "${service}" ; then + best_interface="$(select_best_interface)" + apply_state "${best_interface}" + fi fi echo "${action}" exit 0 @@ -41,12 +44,12 @@ case "${action}" in esac # Map MAC address variables to interface variables -macnet_pre_start "${interface}" 1>/dev/null +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}" 1>/dev/null + essidnet_pre_start "${interface}" fi fi @@ -104,16 +107,17 @@ fi [[ ${d} != *" nontp "* ]] && system_ntp "${interface}" [[ ${d} != *" nonis "* ]] && system_nis "${interface}" -if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then - best_interface="$(select_best_interface)" - apply_state "${best_interface}" -else - apply_state "${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 -service_inactive "${service}" && mark_service_started "${service}" - echo "${action}" exit 0 -# vim:ts=4 +# 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 index 0b5d3c7..b16e6cc 100644 --- a/net-scripts/net.modules.d/helpers.d/dhcp-state +++ b/net-scripts/net.modules.d/helpers.d/dhcp-state @@ -1,11 +1,9 @@ -#!/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) -. "${svclib}/sh/rc-services.sh" -. "${svclib}/net.modules.d/helpers.d/functions" +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}" @@ -18,11 +16,13 @@ else service_inactive "${service}" && mark_service_started "${service}" fi -if [[ ${RC_AUTO_INTERFACE} == "yes" ]] ; then - best_interface="$(select_best_interface)" - apply_state "${best_interface}" -elif [[ ${action} == "up" ]] ; then - apply_state "${interface}" +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:ts=4 +# 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 index ce86a3d..ca4778b 100755 --- a/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper +++ b/net-scripts/net.modules.d/helpers.d/dhcpcd-wrapper @@ -1,7 +1,6 @@ #!/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-}" @@ -13,16 +12,17 @@ else action="up" fi -. /sbin/functions.sh -. "${svclib}/net.modules.d/helpers.d/module-loader" +[[ ${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}" 1>/dev/null +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}" 1>/dev/null + essidnet_pre_start "${interface}" fi fi @@ -58,6 +58,6 @@ else fi [[ -x ${exe} ]] && ( ${exe} "$@" 1>/dev/null ) -. "${svclib}/net.modules.d/helpers.d/dhcp-state" +source "${svclib}/net.modules.d/helpers.d/dhcp-state" -# vim:ts=4 +# vim: ts=4 : diff --git a/net-scripts/net.modules.d/helpers.d/functions b/net-scripts/net.modules.d/helpers.d/functions index ff67435..6975bf1 100644 --- a/net-scripts/net.modules.d/helpers.d/functions +++ b/net-scripts/net.modules.d/helpers.d/functions @@ -1,6 +1,6 @@ -#!/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) # We will be loaded after conf.d/rc and conf.d/net so we can set a default # here. @@ -563,4 +563,4 @@ if [[ -z $(type -p hostname) ]] ; then } fi -# vim:ts=4 +# 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 index f978f68..e0477d4 100644 --- a/net-scripts/net.modules.d/helpers.d/module-loader +++ b/net-scripts/net.modules.d/helpers.d/module-loader @@ -1,27 +1,19 @@ -#!/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) -. "${svclib}/sh/rc-services.sh" +source "${svclib}/sh/rc-services.sh" MODULES_DIR="${svclib}/net.modules.d" -. "${MODULES_DIR}/system" -. "${MODULES_DIR}/helpers.d/functions" +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}" -# Create some dummy functions, so we can depend on a module -after() { return; } -before() { return; } -need() { return; } -provide() { return; } -installed() { return; } -functions() { return; } +# So we can expose module variables variables() { eval "${MODULE}_variables() { echo \"$*\"; }"; } # Guess which interface module to load - we prefer iproute2 @@ -46,30 +38,26 @@ fi MODULES=( "system" ) # Load our modules -. "${MODULES_DIR}/${interface_module}" +source "${MODULES_DIR}/${interface_module}" MODULE="interface" -${interface_module}_depend +${interface_module}_expose function_wrap "${interface_module}" interface if [[ -e "${MODULES_DIR}/macnet" ]] ; then - . "${MODULES_DIR}/macnet" - MODULE="macnet" - macnet_depend + source "${MODULES_DIR}/macnet" fi . "${MODULES_DIR}/system" MODULE="system" -system_depend +system_expose if [[ -n ${wireless_module} ]] ; then - . "${MODULES_DIR}/${wireless_module}" - MODULE="${wireless_module}" - ${wireless_module}_depend + source "${MODULES_DIR}/${wireless_module}" function_wrap "${wireless_module}" wireless - . "${MODULES_DIR}/essidnet" + source "${MODULES_DIR}/essidnet" fi # Dummy dhcp dhcp_variables() { echo "dhcp"; } -# vim:ts=4 +# 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 index c7f6f90..0cf23fd 100644 --- a/net-scripts/net.modules.d/helpers.d/pppd-wrapper +++ b/net-scripts/net.modules.d/helpers.d/pppd-wrapper @@ -1,14 +1,16 @@ #!/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" -. /sbin/functions.sh -. "${svclib}/net.modules.d/helpers.d/module-loader" + +[[ ${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 @@ -41,4 +43,4 @@ else /etc/init.d/net."${interface}" stop fi -# vim:ts=4 +# 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 index 981480d..60d1357 100755 --- a/net-scripts/net.modules.d/helpers.d/pump-wrapper +++ b/net-scripts/net.modules.d/helpers.d/pump-wrapper @@ -1,7 +1,6 @@ #!/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 @@ -9,24 +8,25 @@ action="$1" interface="$2" -. /sbin/functions.sh +[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh +RC_QUIET_STDOUT="yes" if [[ ${action} == "up" ]] ; then - . "${svclib}/net.modules.d/helpers.d/module-loader" + source "${svclib}/net.modules.d/helpers.d/module-loader" # Map MAC address variables to interface variables - macnet_pre_start "${interface}" 1>/dev/null + 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}" 1>/dev/null + essidnet_pre_start "${interface}" fi fi system_dns_extra "${interface}" "${statedir}/${interface}/resolv.conf" fi -. "${svclib}/net.modules.d/helpers.d/dhcp-state" +source "${svclib}/net.modules.d/helpers.d/dhcp-state" -# vim:ts=4 +# 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 index 9548d07..e63f7ee 100755 --- a/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper +++ b/net-scripts/net.modules.d/helpers.d/udhcpc-wrapper @@ -1,7 +1,6 @@ -#!/bin/sh +#!/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 @@ -15,7 +14,9 @@ export ntp_servers_${interface}="${ntpsrv}" export nis_domain_${interface}="${nisdomain}" export nis_servers_${interface}="${nissrv}" -. /sbin/functions.sh +[[ ${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 @@ -24,4 +25,4 @@ if [[ $? == 0 ]] && [[ $1 == "bound" || $1 == "renew" ]] ; then chmod 600 "/var/cache/udhcpc-${interface}.lease" fi -# vim:ts=4 +# vim: ts=4 : diff --git a/net-scripts/net.modules.d/ifconfig b/net-scripts/net.modules.d/ifconfig index 966f817..bec988e 100644 --- a/net-scripts/net.modules.d/ifconfig +++ b/net-scripts/net.modules.d/ifconfig @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Fix any potential localisation problems @@ -23,6 +21,12 @@ route() { # Sets up the dependancies for the module ifconfig_depend() { provide interface +} + +# void ifconfig_expose(void) +# +# Expose variables that can be configured +ifconfig_expose() { variables config routes fallback metric ifconfig \ ifconfig_fallback routes inet6 iface alias broadcast netmask } @@ -446,4 +450,4 @@ ifconfig_default_route() { route add default gw "$2" metric "${metric}" dev "$1" } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/ifplugd b/net-scripts/net.modules.d/ifplugd index 13d4e89..8fa1cc1 100644 --- a/net-scripts/net.modules.d/ifplugd +++ b/net-scripts/net.modules.d/ifplugd @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# 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 ifplugd_depend(void) @@ -14,6 +12,13 @@ ifplugd_depend() { provide plug } +# void ifplugd_expose(void) +# +# Expose variables that can be configured +ifplugd_expose() { + variables plug_timeout +} + # bool ifplugd_check_installed(void) # # Returns 0 if ifplugd is installed, otherwise 1 @@ -138,4 +143,4 @@ ifplugd_stop() { eend $? } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/ip6to4 b/net-scripts/net.modules.d/ip6to4 index a833609..4dde13f 100644 --- a/net-scripts/net.modules.d/ip6to4 +++ b/net-scripts/net.modules.d/ip6to4 @@ -10,6 +10,12 @@ ip6to4_depend() { after interface functions interface_exists interface_get_address interface_tunnel +} + +# void ip6to4_expose(void) +# +# Expose variables that can be configured +ip6to4_expose() { variables link } @@ -88,3 +94,4 @@ ip6to4_start() { } # vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/ipppd b/net-scripts/net.modules.d/ipppd index e7f5c2e..0280ea6 100644 --- a/net-scripts/net.modules.d/ipppd +++ b/net-scripts/net.modules.d/ipppd @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Contributed by Roy Marples (uberlord@gentoo.org) @@ -69,3 +69,4 @@ ipppd_stop() { } # vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/iproute2 b/net-scripts/net.modules.d/iproute2 index c1c2dea..498eea6 100644 --- a/net-scripts/net.modules.d/iproute2 +++ b/net-scripts/net.modules.d/iproute2 @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Fix any potential localisation problems @@ -9,7 +7,6 @@ ip() { LC_ALL=C /sbin/ip "$@" } - iproute2_tunnel() { LC_ALL=C /sbin/ip tunnel "$@" } @@ -20,6 +17,12 @@ iproute2_tunnel() { iproute2_depend() { provide interface functions interface_device +} + +# void iproute2_expose(void) +# +# Expose variables that can be configured +iproute2_expose() { variables config routes fallback metric ipaddr ipaddr_fallback iproute inet6 } @@ -386,4 +389,4 @@ iproute2_post_stop() { ip route flush cache dev "${iface}" } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/iptunnel b/net-scripts/net.modules.d/iptunnel index 0f951ea..ff62bb9 100644 --- a/net-scripts/net.modules.d/iptunnel +++ b/net-scripts/net.modules.d/iptunnel @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# 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 iptunnel_depend(void) @@ -10,6 +8,12 @@ iptunnel_depend() { before interface functions interface_exists interface_tunnel +} + +# void iptunnel_expose(void) +# +# Expose variables that can be configured +iptunnel_expose() { variables iptunnel } @@ -45,4 +49,4 @@ iptunnel_stop() { eend $? } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/iwconfig b/net-scripts/net.modules.d/iwconfig index 34082d4..73fa5b0 100644 --- a/net-scripts/net.modules.d/iwconfig +++ b/net-scripts/net.modules.d/iwconfig @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Many thanks to all the people in the Gentoo forums for their ideas and # motivation for me to make this and keep on improving it @@ -31,6 +29,13 @@ iwconfig_depend() { functions interface_up interface_down interface_exists } +# void iwconfig_expose(void) +# +# Expose variables that can be configured +iwconfig_expose() { + variables essid mode associate_timeout sleep_scan preferred_aps blacklist_aps +} + # bool iwconfig_check_installed(void) # # Returns 1 if wireless-tools is installed, otherwise 0 @@ -82,8 +87,8 @@ iwconfig_get_essid() { local i essid for (( i=0; i<5; i++ )); do - essid="$( iwgetid "$1" 2>/dev/null | sed -n -e 's/^.*ESSID:"\(.*\)"$/\1/p' )" - if [[ -n ${essid} ]]; then + essid="$( iwgetid --raw "$1" )" + if [[ -n ${essid} ]] ; then echo "${essid}" return 0 fi @@ -98,7 +103,7 @@ iwconfig_get_essid() { # Returns the MAC address of the Access Point # the interface is connected to iwconfig_get_ap_mac_address() { - iwgetid --ap "$1" | sed -n -e 's/^.*Cell: .*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' + iwgetid --raw --ap "$1" } # char* iwconfig_get_mode(char *interface) @@ -119,25 +124,25 @@ iwconfig_get_type() { # # Output how our wireless interface has been configured iwconfig_report() { - local iface="$1" essid mac m="to" + local iface="$1" essid mac m="connected to" essid="$( iwconfig_get_essid "${iface}" )" local wep_status="$( iwconfig_get_wep_status "${iface}" )" - local channel="$( iwgetid --channel "${iface}" 2>/dev/null | cut -d: -f2 )" + local channel="$( iwgetid --raw --channel "${iface}" )" [[ -n ${channel} ]] && channel="on channel ${channel} " essid="${essid//\\\\/\\\\}" local mode="$( iwconfig_get_mode "${iface}" )" if [[ ${mode} == "master" ]]; then - m="as" - elif [[ ${mode} != "ad-hoc" ]]; then + m="configured as" + else mac="$( iwconfig_get_ap_mac_address "${iface}" )" [[ -n ${mac} ]] && mac=" at ${mac}" fi eindent - einfo "${iface} connected ${m} \"${essid}\"${mac}" + einfo "${iface} ${m} ESSID \"${essid}\"${mac}" einfo "in ${mode} mode ${channel}${wep_status}" eoutdent } @@ -291,7 +296,7 @@ iwconfig_test_associated() { mac) iwconfig_associate_mac "${iface}" && return 0 ;; quality) iwconfig_associate_quality "${iface}" && return 0 ;; all) iwconfig_associate_mac "${iface}" \ - && iwconfig_associate_quality "${iface}" && return 0 ;; + && iwconfig_associate_quality "${iface}" && return 0 ;; esac return 1 @@ -371,7 +376,7 @@ iwconfig_associate() { # Finally apply the user Config iwconfig_user_config "${iface}" "${ESSIDVAR}" - vebegin "Connecting to \"${dessid}\" ${w}" + vebegin "Connecting to \"${dessid}\" in ${mode} mode ${w}" if [[ ${ESSID} != "any" ]] && is_function preassociate ; then veinfo "Running preassociate function" @@ -434,8 +439,8 @@ iwconfig_scan() { fi # Set the essid to any. This is required for scanning - #iwconfig "${iface}" essid any - + iwconfig "${iface}" essid any + veinfo "Scanning for access points" # Sleep if required @@ -540,8 +545,9 @@ iwconfig_scan_report() { # dynamically remove from the array eindent for ((i=0; i<${#mac_APs[@]}; i++)); do - k="" - [[ ${enc_APs[i]} == "yes" ]] && k="(WEP required)" + k="(${mode_APs[i]}" + [[ ${enc_APs[i]} != "off" ]] && k="${k}, encrypted" + k="${k})" if [[ -z ${essid_APs[i]} ]]; then veinfo "Found ${mac_APs[i]} ${k}" @@ -682,19 +688,11 @@ iwconfig_defaults() { local iface="$1" # Set some defaults - iwconfig "${iface}" rate auto &>/dev/null - iwconfig "${iface}" rts auto &>/dev/null - iwconfig "${iface}" frag auto &>/dev/null - iwconfig "${iface}" txpower auto &>/dev/null - iwconfig "${iface}" key [1] off &>/dev/null - iwconfig "${iface}" mode managed &>/dev/null - iwconfig "${iface}" ap off &>/dev/null + iwconfig "${iface}" rate auto 2>/dev/null + iwconfig "${iface}" rts auto 2>/dev/null + iwconfig "${iface}" frag auto 2>/dev/null + iwconfig "${iface}" txpower auto 2>/dev/null - # According to the iwconfig man page we should be doing - # iwconfig "${iface}" essid -- off &>/dev/null - # instead. However, this borks many drivers - setting essid - # to "" seems to work for all drivers however. - iwconfig "${iface}" essid "" &>/dev/null } # void iwconfig_strip_associated(char *iface) @@ -917,4 +915,4 @@ iwconfig_post_stop() { iwconfig_defaults "${iface}" } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/macchanger b/net-scripts/net.modules.d/macchanger index a81d888..76720b6 100644 --- a/net-scripts/net.modules.d/macchanger +++ b/net-scripts/net.modules.d/macchanger @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# 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 macchanger_depend(void) @@ -10,6 +8,12 @@ macchanger_depend() { before macnet functions interface_get_mac_address interface_set_mac_address +} + +# void macchanger_expose(void) +# +# Expose variables that can be configured +macchanger_expose() { variables mac } @@ -95,4 +99,4 @@ macchanger_pre_start() { return 0 #important } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/macnet b/net-scripts/net.modules.d/macnet index d4a52bb..6be0a4b 100644 --- a/net-scripts/net.modules.d/macnet +++ b/net-scripts/net.modules.d/macnet @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2005 Gentoo Foundation +# Copyright (c) 2005-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Many thanks to all the people in the Gentoo forums for their ideas and # motivation for me to make this and keep on improving it @@ -42,4 +40,4 @@ macnet_pre_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/netplugd b/net-scripts/net.modules.d/netplugd index 244e047..cd8ebe2 100644 --- a/net-scripts/net.modules.d/netplugd +++ b/net-scripts/net.modules.d/netplugd @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2005-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # void netplugd_depend(void) @@ -14,6 +12,13 @@ netplugd_depend() { functions interface_exists interface_get_mac_address } +# void netplugd_expose(void) +# +# Expose variables that can be configured +netplugd_expose() { + variables plug_timeout +} + # bool netplugd_check_installed(void) # # Returns 0 if netplug is installed, otherwise 1 @@ -116,4 +121,4 @@ netplugd_stop() { eend $? } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/pppd b/net-scripts/net.modules.d/pppd index eba4b21..97caf6b 100644 --- a/net-scripts/net.modules.d/pppd +++ b/net-scripts/net.modules.d/pppd @@ -1,5 +1,4 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2005-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # void pppd_depend(void) @@ -277,4 +276,4 @@ pppd_stop() { eend $? } -# vim: ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/pump b/net-scripts/net.modules.d/pump index f50a695..a2dacfc 100644 --- a/net-scripts/net.modules.d/pump +++ b/net-scripts/net.modules.d/pump @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Fix any potential localisation problems @@ -17,6 +15,12 @@ pump_depend() { after interface provide dhcp functions interface_exists interface_get_address +} + +# void pump_expose(void) +# +# Expose variables that can be configured +pump_expose() { variables pump dhcp } @@ -98,4 +102,4 @@ pump_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/rename b/net-scripts/net.modules.d/rename index a9f8b8b..43a6da1 100644 --- a/net-scripts/net.modules.d/rename +++ b/net-scripts/net.modules.d/rename @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2005 Gentoo Foundation +# Copyright (c) 2005-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # void rename_depend(void) @@ -11,6 +9,12 @@ rename_depend() { after macchanger before wireless interface functions interface_exists interface_down interface_del_addresses +} + +# void rename_expose(void) +# +# Expose variables that can be configured +rename_expose() { variables rename } @@ -56,4 +60,4 @@ rename_pre_start() { exit 1 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/system b/net-scripts/net.modules.d/system index df28279..5d841d3 100644 --- a/net-scripts/net.modules.d/system +++ b/net-scripts/net.modules.d/system @@ -1,6 +1,6 @@ -#!/bin/bash -# Copyright (c) 2005 Gentoo Foundation +# Copyright (c) 2005-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +# Contributed by Roy Marples (uberlord@gentoo.org) # void system_depend(void) # @@ -8,6 +8,12 @@ system_depend() { after interface before dhcp +} + +# void system_expose(void) +# +# Expose variables that can be configured +system_expose() { variables dns_servers dns_domain dns_options dns_search dns_sortlist \ ntp_servers nis_domain nis_servers } @@ -146,4 +152,4 @@ system_pre_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/tuntap b/net-scripts/net.modules.d/tuntap index c37ae91..e0d1865 100644 --- a/net-scripts/net.modules.d/tuntap +++ b/net-scripts/net.modules.d/tuntap @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Fix any potential localisation problems @@ -19,6 +17,12 @@ tunctl() { tuntap_depend() { before interface macchanger functions interface_exists interface_type +} + +# void tuntap_expose(void) +# +# Expose variables that can be configured +tuntap_expose() { variables tunctl } @@ -96,4 +100,4 @@ tuntap_stop() { eend $? } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/udhcpc b/net-scripts/net.modules.d/udhcpc index 7e998a4..041afb2 100644 --- a/net-scripts/net.modules.d/udhcpc +++ b/net-scripts/net.modules.d/udhcpc @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Fix any potential localisation problems @@ -17,6 +15,12 @@ udhcpc_depend() { after interface provide dhcp functions interface_exists interface_get_address +} + +# void udhcpc_expose(void) +# +# Expose variables that can be configured +udhcpc_expose() { variables udhcpc dhcp } @@ -110,4 +114,4 @@ udhcpc_start() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/vlan b/net-scripts/net.modules.d/vlan index 4a103c2..393bc72 100644 --- a/net-scripts/net.modules.d/vlan +++ b/net-scripts/net.modules.d/vlan @@ -1,7 +1,5 @@ -#!/bin/bash -# Copyright (c) 2004-2005 Gentoo Foundation +# Copyright (c) 2004-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 - # Contributed by Roy Marples (uberlord@gentoo.org) # Fix any potential localisation problems @@ -17,7 +15,13 @@ vlan_depend() { after interface before dhcp functions iface_start iface_stop - variables vlans +} + +# void vlan_expose(void) +# +# Expose variables that can be configured +vlan_expose() { + variables vlans } # bool vlan_check_installed(void) @@ -147,4 +151,4 @@ vlan_stop() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : diff --git a/net-scripts/net.modules.d/wpa_supplicant b/net-scripts/net.modules.d/wpa_supplicant index 184fd4d..22343a7 100644 --- a/net-scripts/net.modules.d/wpa_supplicant +++ b/net-scripts/net.modules.d/wpa_supplicant @@ -1,7 +1,5 @@ -#!/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) # Fix any potential localisation problems @@ -24,6 +22,13 @@ wpa_supplicant_depend() { functions interface_exists } +# void wpa_supplicant_expose(void) +# +# Expose variables that can be configured +wpa_supplicant_expose() { + variables associate_timeout wpa_supplicant +} + # bool wpa_supplicant_check_installed(void) # # Returns 0 if wpa_supplicant is installed, otherwise 1 @@ -360,4 +365,4 @@ wpa_supplicant_post_stop() { return 0 } -# vim:ts=4 +# vim: set ft=sh ts=4 : |