summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Pryor <profjim@jimpryor.net>2009-08-11 18:49:08 +0200
committerJames Rayner <james@archlinux.org>2009-09-07 12:04:04 +0200
commit6b0c686613a26541ce3164d9e995f639ef3a9b9f (patch)
tree67b2d4e8d1fa500752be8c657491afe2bb9db14b /src
parent6e369d4a1e082be88c3e8132477452c2dda3cf0e (diff)
downloadnetctl-6b0c686613a26541ce3164d9e995f639ef3a9b9f.tar.gz
netctl-6b0c686613a26541ce3164d9e995f639ef3a9b9f.tar.xz
Comments, more harmless bits
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src')
-rw-r--r--src/connections/ethernet-iproute8
-rw-r--r--src/connections/wireless17
-rw-r--r--src/net-profiles2
-rw-r--r--src/netcfg-menu4
4 files changed, 20 insertions, 11 deletions
diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute
index eedda15..f0ac995 100644
--- a/src/connections/ethernet-iproute
+++ b/src/connections/ethernet-iproute
@@ -102,11 +102,9 @@ ethernet_up() {
[[ -n "$DOMAIN" ]] && echo "domain $DOMAIN" >>/etc/resolv.conf
[[ -n "$SEARCH" ]] && echo "search $SEARCH" >>/etc/resolv.conf
- if [[ -n "$DNS" ]]; then
- for dns in "${DNS[@]}"; do
- echo "nameserver $dns" >>/etc/resolv.conf
- done
- fi
+ for dns in "${DNS[@]}"; do
+ echo "nameserver $dns" >>/etc/resolv.conf
+ done
fi
return 0
}
diff --git a/src/connections/wireless b/src/connections/wireless
index 2951cdd..c7e54ed 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -57,8 +57,12 @@ wireless_up() {
quirk prescan && iwlist "$INTERFACE" scan &> /dev/null # bcm43xx
if quirk preessid; then # ipw3945
if [[ -n "$AP" ]]; then # JP: enable use of AP
+ # JP: Since I don't undertand why the else block below is an eval, I'm not sure
+ # if this command also needs to be eval'd
iwconfig "$INTERFACE" mode managed ap "$AP"
else
+ # JP: I don't understand why this needs to be an eval. What's wrong with just:
+ # iwconfig "$INTERFACE" mode managed essid "$ESSID"
eval "iwconfig \"$INTERFACE\" mode managed essid \"$ESSID\""
fi
fi
@@ -73,7 +77,7 @@ wireless_up() {
# but instead we explicitly pass $CONNECTION
fi
if [[ $? -gt 0 ]]; then
- report_fail "Network \"$OLDESSID\" not present."
+ report_fail "Wireless network \"$OLDESSID\" not present."
return 1
fi
fi
@@ -93,9 +97,9 @@ wireless_up() {
if [[ -z "$WEP_OPTS" ]]; then
if [[ "$SECURITY" = "wep" ]]; then
if [[ -n "$AP" ]]; then
- WEP_OPTS="ap \"$AP\" key $KEY"
+ WEP_OPTS="ap \"$AP\" key $KEY" # JP: formerly I had "...key open $KEY"; is it correct to omit the 'open'?
else
- WEP_OPTS="essid \"$ESSID\" key $KEY"
+ WEP_OPTS="essid \"$ESSID\" key $KEY" # JP: formerly I had "...key open $KEY"; is it correct to omit the 'open'?
fi
elif [[ "$SECURITY" = "none" ]]; then
if [[ -n "$AP" ]]; then
@@ -113,6 +117,8 @@ wireless_up() {
fi
report_debug wireless_up iwconfig "$INTERFACE" $WEP_OPTS
+ # JP: I don't understand why this needs to be an eval. What's wrong with just:
+ # iwconfig "$INTERFACE" $WEP_OPTS
if ! eval "iwconfig \"$INTERFACE\" $WEP_OPTS"; then
report_fail "Could not set wireless configuration."
return 1
@@ -133,8 +139,12 @@ wireless_up() {
# Quirk for broken drivers... http://bbs.archlinux.org/viewtopic.php?id=36384
if quirk "wpaessid"; then
if [[ -n "$AP" ]]; then
+ # JP: Since I don't undertand why the else block below is an eval, I'm not sure
+ # if this command also needs to be eval'd
iwconfig "$INTERFACE" ap "$AP"
else
+ # JP: I don't understand why this needs to be an eval. What's wrong with just:
+ # iwconfig "$INTERFACE" essid "$ESSID"
eval "iwconfig \"$INTERFACE\" essid \"$ESSID\""
fi
fi
@@ -195,6 +205,7 @@ wireless_up() {
fi
}
+# wireless_down PROFILE [ LEAVE ifconfig up? default no ]
wireless_down() {
local PROFILE="$1" NOETHERNETDOWN="$2"
load_profile "$PROFILE"
diff --git a/src/net-profiles b/src/net-profiles
index 3827c54..6ab179a 100644
--- a/src/net-profiles
+++ b/src/net-profiles
@@ -10,7 +10,7 @@ case "$1" in
# Ensure any device renaming has occurred as intended
for daemon in "${DAEMONS[@]}"; do
- if [ "$daemon" = "${daemon#!}" -a "$daemon" = "net-rename" ]; then
+ if [[ "$daemon" = "${daemon#!}" && "$daemon" = "net-rename" ]]; then
if ck_daemon net-rename; then
/etc/rc.d/net-rename start
fi
diff --git a/src/netcfg-menu b/src/netcfg-menu
index 2736ee1..b24455c 100644
--- a/src/netcfg-menu
+++ b/src/netcfg-menu
@@ -10,7 +10,7 @@ i=0
# JP: change for prof to while read prof to avoid assumption that profile names are always single tokens (no spaces etc.)
while read prof; do
# if there is a profile called "main", Use as default
- [ "$prof" = "main" ] && DEFAULT="main"
+ [[ "$prof" = "main" ]] && DEFAULT="main"
unset DESCRIPTION # JP: we can''t sandbox the sourced profiles, because we need to expose profiles[]
. "$PROFILE_DIR/$prof"
profiles[$i]="$prof"
@@ -50,7 +50,7 @@ case $ret in
if [[ $ret -eq 0 ]]; then echo "$DEFAULT" > "$STATE_DIR/menu"; fi
;;
0) # User selection
- profile_up "$(cat "$ANSWER")"
+ profile_up $(cat "$ANSWER")
ret=$?
if [[ $ret -eq 0 ]]; then mv "$ANSWER" "$STATE_DIR/menu"; fi
;;