summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heim <phreak@gentoo.org>2006-01-10 10:19:01 +0000
committerChristian Heim <phreak@gentoo.org>2006-01-10 10:19:01 +0000
commit371175bc9871daf7fc1d6d8a1e424e4e853fe31d (patch)
tree88523f022270400394837b9a9dabd7c0f33a2184
parentMerging latest changes to the baselayout-1_12 branch. This merge is based upo... (diff)
downloadbaselayout-vserver-371175bc9871daf7fc1d6d8a1e424e4e853fe31d.tar.gz
baselayout-vserver-371175bc9871daf7fc1d6d8a1e424e4e853fe31d.tar.bz2
baselayout-vserver-371175bc9871daf7fc1d6d8a1e424e4e853fe31d.zip
Merging revision 1797
svn path=/baselayout-vserver/branches/baselayout-1_12/; revision=193
-rw-r--r--ChangeLog23
-rw-r--r--ChangeLog.vserver15
-rw-r--r--net-scripts/conf.d/wireless.example12
-rw-r--r--net-scripts/net.modules.d/helpers.d/module-loader4
-rw-r--r--net-scripts/net.modules.d/iwconfig45
-rw-r--r--net-scripts/net.modules.d/wpa_supplicant2
-rw-r--r--sbin/functions.sh8
-rwxr-xr-xsbin/rc21
-rwxr-xr-xsbin/runscript.sh35
9 files changed, 115 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index bd580a3..2112d53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,29 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2
+ 09 Jan 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Ensure that specific configuration is loaded after net, #118368.
+
+ iwconfig now supports multiple iwconfig_* and iwpriv_* statements and is
+ also configurable for specific ESSIDs. This allows use to use the inbuilt
+ WPA support in the rt2500 driver.
+
+ module-loader now loads interface specific configuration files, #118366.
+
+ 07 Jan 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Save a few CPU cycles by storing add_suffix in variable.
+
+ 06 Jan 2006; Roy Marples <uberlord@gentoo.org>:
+
+ Use ${DEFAULTLEVEL} if ${SOFTLEVEL} is boot, shutdown, reboot or single
+ in add_suffix.
+
+ Sync style changes in functions.sh
+
+ Critical services now load a suffixed config and fail gracefully.
+
05 Jan 2006; Roy Marples <uberlord@gentoo.org>:
iproute deletes addresses again, fixes #117799.
diff --git a/ChangeLog.vserver b/ChangeLog.vserver
index 88a2d2a..ccf6ae1 100644
--- a/ChangeLog.vserver
+++ b/ChangeLog.vserver
@@ -1,6 +1,21 @@
# ChangeLog for Gentoo System Intialization ("rc") scripts
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPLv2
+ 10 Jan 2006; Christian Heim <phreak@gentoo.org>:
+ Merging latest changes to the baselayout-1_12 branch. This merge is based
+ upon revision 1797.
+
+ ChangeLog | 23 +++++++++
+ ChangeLog.vserver | 15 ++++++
+ net-scripts/conf.d/wireless.example | 12 +++-
+ net-scripts/net.modules.d/helpers.d/module-loader | 4 +
+ net-scripts/net.modules.d/iwconfig | 45 ++++++++++--------
+ net-scripts/net.modules.d/wpa_supplicant | 2
+ sbin/functions.sh | 8 +--
+ sbin/rc | 21 +++++---
+ sbin/runscript.sh | 35 +++++++-------
+ 9 files changed, 115 insertions(+), 50 deletions(-)
+
06 Jan 2006; Christian Heim <phreak@gentoo.org>:
Merging latest changes to the baselayout-1_12 branch. This merge is based
upon revision 1792.
diff --git a/net-scripts/conf.d/wireless.example b/net-scripts/conf.d/wireless.example
index 18e27b5..b50afdc 100644
--- a/net-scripts/conf.d/wireless.example
+++ b/net-scripts/conf.d/wireless.example
@@ -92,12 +92,18 @@
#channel_eth0="3"
# Setup any other config commands. This is basically the iwconfig argument
-# without the iwconfig $iface
+# without the iwconfig $iface.
#iwconfig_eth0=""
# Set private driver ioctls. This is basically the iwpriv argument without
-# the iwpriv $iface
+# the iwpriv $iface. If you use the rt2500 driver (not the rt2x00 one) then
+# you can set WPA here, below is an example.
#iwpriv_eth0=""
+#iwpriv_ESSID=(
+# "set AuthMode=WPAPSK"
+# "set EncrypType=TKIP"
+# "set WPAPSK=yourpasskey"
+#)
# Seconds to wait before scanning
# Some drivers need to wait until they have finished "loading"
@@ -106,7 +112,7 @@
#sleep_scan_eth0="1"
# Seconds to wait until associated. The default is to wait 10 seconds.
-# 0 means wait indefinitely. WARNING : this can cause an infinite delay when
+# 0 means wait indefinitely. WARNING: this can cause an infinite delay when
# booting.
#associate_timeout_eth0="5"
diff --git a/net-scripts/net.modules.d/helpers.d/module-loader b/net-scripts/net.modules.d/helpers.d/module-loader
index 1fd675b..fe6d1df 100644
--- a/net-scripts/net.modules.d/helpers.d/module-loader
+++ b/net-scripts/net.modules.d/helpers.d/module-loader
@@ -10,7 +10,9 @@ MODULES_DIR="${svclib}/net.modules.d"
. "${MODULES_DIR}/system"
. "${MODULES_DIR}/helpers.d/functions"
-conf=$(add_suffix "/etc/conf.d/net")
+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
diff --git a/net-scripts/net.modules.d/iwconfig b/net-scripts/net.modules.d/iwconfig
index 3f1eb22..232cf0a 100644
--- a/net-scripts/net.modules.d/iwconfig
+++ b/net-scripts/net.modules.d/iwconfig
@@ -68,7 +68,8 @@ iwconfig_get_wep_status() {
if [[ -n ${key} ]]; then
status="enabled"
- mode=" - $( iwconfig "$1" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p' )"
+ mode="$( iwconfig $1 | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p' )"
+ [[ -n ${mode} ]] && mode=" - ${mode}"
fi
echo "(WEP ${status}${mode})"
@@ -81,7 +82,7 @@ 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' )
+ essid="$( iwgetid $1 2>/dev/null | sed -n -e 's/^.*ESSID:"\(.*\)"$/\1/p' )"
if [[ -n ${essid} ]]; then
echo "${essid}"
return 0
@@ -152,27 +153,34 @@ iwconfig_get_wep_key() {
echo "${!key:-off}"
}
-# void iwconfig_user_config(char *iface)
+# void iwconfig_user_config(char *iface, char *ifvar)
#
# Applies the user configuration to the interface
iwconfig_user_config() {
- local iface="$1" conf ifvar=$( bash_variable "$1" )
+ local iface="$1" conf aconf ifvar="$2"
+ [[ -z ${ifvar} ]] && ifvar=$( bash_variable "$1" )
# Apply the user configuration
conf="iwconfig_${ifvar}"
if [[ -n ${!conf} ]]; then
- if ! eval iwconfig "${iface}" "${!conf}" ; then
- ewarn "${iface} does not support the following configuration commands"
- eval ewarn " ${!conf}"
- fi
+ aconf=( "${!conf} ")
+ for conf in "${aconf[@]}" ; do
+ if ! eval iwconfig "${iface}" "${conf}" ; then
+ ewarn "${iface} does not support the following configuration commands"
+ ewarn " ${conf}"
+ fi
+ done
fi
- conf="iwpriv_${ifvar}"
+ conf="iwpriv_${ifvar}[@]"
if [[ -n ${!conf} ]]; then
- if ! eval iwpriv "${iface}" "${!conf}" ; then
- ewarn "${iface} does not support the following private ioctls"
- ewarn " ${!conf}"
- fi
+ aconf=( "${!conf}" )
+ for conf in "${aconf[@]}" ; do
+ if ! eval iwpriv "${iface}" "${conf}" ; then
+ ewarn "${iface} does not support the following private ioctls"
+ ewarn " ${conf}"
+ fi
+ done
fi
}
@@ -217,6 +225,8 @@ iwconfig_setup_specific() {
fi
fi
+ iwconfig_user_config "${iface}" "${ESSIDVAR}"
+
# Finally set the ESSID
if ! iwconfig "${iface}" essid "${ESSID}" ; then
eerror "${iface} does not support setting ESSID to \"${dessid}\""
@@ -224,7 +234,6 @@ iwconfig_setup_specific() {
fi
iwconfig "${iface}" nick "${ESSID}" 2>/dev/null
- iwconfig_user_config "${iface}"
iwconfig_report "${iface}"
return 0
@@ -331,12 +340,11 @@ iwconfig_associate() {
ESSIDVAR=$( bash_variable "${ESSID}" )
key=$( iwconfig_get_wep_key "${mac}" )
if [[ ${wep_required} == "on" && ${key} == "off" ]]; then
- vewarn "WEP key is not set for \"${dessid}\" - not connecting"
- return 1
+ ewarn "WEP key is not set for \"${dessid}\""
fi
if [[ ${wep_required} == "off" && ${key} != "off" ]]; then
key="off"
- vewarn "\"${dessid}\" is not WEP enabled - ignoring setting"
+ ewarn "\"${dessid}\" is not WEP enabled - ignoring setting"
fi
if ! eval iwconfig "${iface}" key "${key}" ; then
@@ -349,6 +357,8 @@ iwconfig_associate() {
[[ ${key} != "off" ]] && w=$( iwconfig_get_wep_status "${iface}" )
fi
+ iwconfig_user_config "${iface}" "${ESSIDVAR}"
+
if ! iwconfig "${iface}" essid "${ESSID}" ; then
if [[ ${ESSID} != "any" ]]; then
ewarn "${iface} does not support setting ESSID to \"${dessid}\""
@@ -382,7 +392,6 @@ iwconfig_associate() {
return $?
fi
- iwconfig_user_config "${iface}"
iwconfig_report "${iface}"
if is_function postassociate ; then
diff --git a/net-scripts/net.modules.d/wpa_supplicant b/net-scripts/net.modules.d/wpa_supplicant
index ad5e1ed..8458c0f 100644
--- a/net-scripts/net.modules.d/wpa_supplicant
+++ b/net-scripts/net.modules.d/wpa_supplicant
@@ -58,7 +58,7 @@ wpa_supplicant_get_essid() {
local i essid
for (( i=0; i<5; i++ )); do
- essid=$( wpa_cli -i"$1" status | sed -n -e 's/^ssid=//p' )
+ essid="$( wpa_cli -i$1 status | sed -n -e 's/^ssid=//p' )"
if [[ -n ${essid} ]]; then
echo "${essid}"
return 0
diff --git a/sbin/functions.sh b/sbin/functions.sh
index 0ab3fff..c187939 100644
--- a/sbin/functions.sh
+++ b/sbin/functions.sh
@@ -271,7 +271,7 @@ _eend() {
local retval=${1:-0} efunc=${2:-eerror} msg
shift 2
- if [[ ${retval} == "0" ]]; then
+ if [[ ${retval} == "0" ]] ; then
[[ ${RC_QUIET_STDOUT} == "yes" ]] && return 0
msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
else
@@ -714,7 +714,7 @@ else
fi
fi
-if [[ -n ${EBUILD} && $* == *depend* ]]; then
+if [[ -n ${EBUILD} && $* == *depend* ]] ; then
# We do not want stty to run during emerge depend
COLS=80
else
@@ -724,14 +724,14 @@ else
(( COLS > 0 )) || (( COLS = 80 )) # width of [ ok ] == 7
fi
-if [[ ${RC_ENDCOL} == "yes" ]]; then
+if [[ ${RC_ENDCOL} == "yes" ]] ; then
ENDCOL=$'\e[A\e['$(( COLS - 8 ))'C'
else
ENDCOL=''
fi
# Setup the colors so our messages all look pretty
-if [[ ${RC_NOCOLOR} == "yes" ]]; then
+if [[ ${RC_NOCOLOR} == "yes" ]] ; then
unset GOOD WARN BAD NORMAL HILITE BRACKET
else
GOOD=$'\e[32;01m'
diff --git a/sbin/rc b/sbin/rc
index e54b6a6..2dd94dc 100755
--- a/sbin/rc
+++ b/sbin/rc
@@ -93,18 +93,25 @@ then
start_critical_service() {
(
local retval=
- local service=$1
+ local service="$1"
# Needed for some addons like dm-crypt that starts in critical services
- local myservice=$1
+ local myservice="$1"
- source "/etc/init.d/${service}" || eerror "Failed to source /etc/init.d/${service}"
+ source "/etc/init.d/${service}"
retval=$?
- [ "${retval}" -ne 0 ] && return "${retval}"
- [ -e "/etc/conf.d/${service}" ] && source "/etc/conf.d/${service}"
- source /etc/rc.conf
+ if [[ ${retval} -ne 0 ]] ; then
+ eerror "Failed to source /etc/init.d/${service}"
+ return "${retval}"
+ fi
+
+ local conf="$(add_suffix /etc/conf.d/${service})"
+ [[ -e ${conf} ]] && source "${conf}"
+ conf="$(add_suffix /etc/rc.conf)"
+ [[ -e ${conf} ]] && source "${conf}"
- start || eerror "Failed to start /etc/init.d/${service}"
+ start
retval=$?
+ [[ ${retval} -ne 0 ]] && eerror "Failed to start /etc/init.d/${service}"
return "${retval}"
)
diff --git a/sbin/runscript.sh b/sbin/runscript.sh
index 1a6b69f..49814b7 100755
--- a/sbin/runscript.sh
+++ b/sbin/runscript.sh
@@ -19,20 +19,20 @@ fi
svcpause="no"
svcrestart="no"
-myscript=$1
+myscript="$1"
if [[ -L $1 && ! -L /etc/init.d/${1##*/} ]] ; then
- myservice=$(readlink "$1")
+ myservice="$(readlink $1)"
else
- myservice=$1
+ myservice="$1"
fi
-myservice=${myservice##*/}
-export SVCNAME=${myservice}
-mylevel=$(<"${svcdir}/softlevel")
+myservice="${myservice##*/}"
+export SVCNAME="${myservice}"
+mylevel="$(<${svcdir}/softlevel)"
# Set $IFACE to the name of the network interface if it is a 'net.*' script
if [[ ${myservice%%.*} == "net" && ${myservice##*.} != "${myservice}" ]] ; then
- IFACE=${myservice##*.}
+ IFACE="${myservice##*.}"
NETSERVICE="yes"
else
IFACE=
@@ -40,17 +40,20 @@ else
fi
# Source configuration files.
-# (1) Source /etc/conf.d/${myservice} to get initscript-specific
+# (1) Source /etc/conf.d/net if it is a net.* service
+# (2) Source /etc/conf.d/${myservice} to get initscript-specific
# configuration (if it exists).
-# (2) Source /etc/conf.d/net if it is a net.* service
# (3) Source /etc/rc.conf to pick up potentially overriding
# configuration, if the system administrator chose to put it
# there (if it exists).
-
-[[ -e $(add_suffix /etc/conf.d/${myservice}) ]] && source "$(add_suffix /etc/conf.d/${myservice})"
-[[ -e $(add_suffix /etc/conf.d/net) ]] && \
-[[ ${NETSERVICE} == "yes" ]] && source "$(add_suffix /etc/conf.d/net)"
-[[ -e $(add_suffix /etc/rc.conf) ]] && source "$(add_suffix /etc/rc.conf)"
+if [[ ${NETSERVICE} == "yes" ]]; then
+ conf="$(add_suffix /etc/conf.d/net)"
+ [[ -e ${conf} ]] && source "${conf}"
+fi
+conf="$(add_suffix /etc/conf.d/${myservice})"
+[[ -e ${conf} ]] && source "${conf}"
+conf="$(add_suffix /etc/rc.conf)"
+[[ -e ${conf} ]] && source "${conf}"
usage() {
local IFS="|"
@@ -127,7 +130,7 @@ svc_stop() {
mydeps="${mydeps} ${myservice}"
else
- mydeps=${myservice}
+ mydeps="${myservice}"
fi
fi
@@ -297,7 +300,7 @@ svc_start() {
$(dolisting "/etc/runlevels/${mylevel}/net.*")"
for y in ${netservices} ; do
- mynetservice=${y##*/}
+ mynetservice="${y##*/}"
if service_stopped "${mynetservice}" ; then
start_service "${mynetservice}"
fi