summaryrefslogtreecommitdiffstats
path: root/src/connections
diff options
context:
space:
mode:
Diffstat (limited to 'src/connections')
-rw-r--r--src/connections/ethernet28
-rw-r--r--src/connections/ethernet-iproute26
-rw-r--r--src/connections/ppp10
-rw-r--r--src/connections/wireless46
4 files changed, 55 insertions, 55 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet
index 71124d0..22405ad 100644
--- a/src/connections/ethernet
+++ b/src/connections/ethernet
@@ -2,7 +2,7 @@
. /usr/lib/network/network
ethernet_up() {
- load_profile $1
+ load_profile "$1"
if [[ ! -e /sys/class/net/"$INTERFACE" ]]; then
if ! echo "$INTERFACE"| fgrep ":"; then
@@ -15,7 +15,7 @@ ethernet_up() {
set_interface up-old "$INTERFACE"
# don't think it's possible to detect carrier using ifconfig alone (at least, not without ifdown/ifupping the interface)
- if [[ $(cat /sys/class/net/$INTERFACE/carrier 2>/dev/null) -ne 1 ]]; then # gives err if iface inactive (i.e. ifdown)
+ if [[ $(cat "/sys/class/net/$INTERFACE/carrier" 2>/dev/null) -ne 1 ]]; then # gives err if iface inactive (i.e. ifdown)
report_fail "No connection"
return 1
fi
@@ -38,18 +38,18 @@ ethernet_up() {
fi
fi
- case $IP in
+ case "$IP" in
dhcp)
if checkyesno "${DHCLIENT:-no}"; then
- rm -r /var/run/dhclient-${INTERFACE}.pid >/dev/null 2>&1
+ rm -r "/var/run/dhclient-${INTERFACE}.pid" >/dev/null 2>&1
report_debug ethernet_up dhclient -q -e TIMEOUT="${DHCP_TIMEOUT:-10}" -pf "/var/run/dhclient-$INTERFACE.pid" "$INTERFACE"
- if ! dhclient -q -e TIMEOUT="${DHCP_TIMEOUT:-10}" -pf /var/run/dhclient-${INTERFACE}.pid $INTERFACE; then
+ if ! dhclient -q -e TIMEOUT="${DHCP_TIMEOUT:-10}" -pf "/var/run/dhclient-${INTERFACE}.pid" "$INTERFACE"; then
report_fail "DHCP IP lease attempt failed."
return 1
fi
else
# Clear remaining pid files.
- rm -f /var/run/dhcpcd-${INTERFACE}.{pid,cache} >/dev/null 2>&1
+ rm -f "/var/run/dhcpcd-${INTERFACE}".{pid,cache} >/dev/null 2>&1
# If using own dns, tell dhcpcd to NOT replace resolv.conf
[[ -n "$DNS1" || -n "$DNS" ]] && DHCP_OPTIONS="-C resolv.conf $DHCP_OPTIONS"
# Start dhcpcd
@@ -75,7 +75,7 @@ ethernet_up() {
# bring up the default route (gateway)
if [[ -n "$GATEWAY" ]]; then
report_debug ethernet_up route add default gw "$GATEWAY"
- if ! route add default gw $GATEWAY; then
+ if ! route add default gw "$GATEWAY"; then
# JP: don't we want to add this to all the aborts?
# ignore quirk nodown---is that appropriate?
# this adds a flush call as well---is that appropriate?
@@ -119,16 +119,16 @@ ethernet_up() {
}
ethernet_down() {
- load_profile $1
- case $IP in
+ load_profile "$1"
+ case "$IP" in
dhcp)
if checkyesno "${DHCLIENT:-no}"; then
- if [[ -f /var/run/dhclient-${INTERFACE}.pid ]]; then
+ if [[ -f "/var/run/dhclient-${INTERFACE}.pid" ]]; then
report_debug ethernet_down kill dhclient
- kill $(cat /var/run/dhclient-${INTERFACE}.pid)
+ kill $(cat "/var/run/dhclient-${INTERFACE}.pid")
fi
else
- if [[ -f /var/run/dhcpcd-${INTERFACE}.pid ]]; then
+ if [[ -f "/var/run/dhcpcd-${INTERFACE}.pid" ]]; then
report_debug ethernet_down dhcpcd -qx "$INTERFACE"
dhcpcd -qx "$INTERFACE" &>/dev/null
fi
@@ -137,7 +137,7 @@ ethernet_down() {
static)
if [[ -n "$GATEWAY" ]]; then
report_debug ethernet_down route del default gw "$GATEWAY"
- route del default gw $GATEWAY
+ route del default gw "$GATEWAY"
fi
;;
esac
@@ -155,6 +155,6 @@ ethernet_status() {
fi
}
-ethernet_$1 $2
+ethernet_$1 "$2"
exit $?
# vim: set ts=4 et sw=4:
diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute
index c50fd7d..385e128 100644
--- a/src/connections/ethernet-iproute
+++ b/src/connections/ethernet-iproute
@@ -9,9 +9,9 @@ report_iproute()
}
ethernet_up() {
- load_profile $1
+ load_profile "$1"
- if [[ ! -e /sys/class/net/$INTERFACE ]]; then
+ if [[ ! -e "/sys/class/net/$INTERFACE" ]]; then
if ! echo "$INTERFACE" | fgrep -q ":"; then
report_iproute "Interface $INTERFACE does not exist"
fi
@@ -24,8 +24,8 @@ ethernet_up() {
report_iproute "No connection"
fi
- if checkyesno ${AUTH8021X:-no}; then
- . ${SUBR_DIR}/8021x
+ if checkyesno "${AUTH8021X:-no}"; then
+ . "${SUBR_DIR}/8021x"
[[ -z "$WPA_CONF" ]] && WPA_CONF="/etc/wpa_supplicant.conf"
[[ -z "$WPA_OPTS" ]] && WPA_OPTS="-Dwired"
@@ -44,10 +44,10 @@ ethernet_up() {
fi
fi
- case $IP in
+ case "$IP" in
dhcp)
# Clear remaining pid files.
- rm -f /var/run/dhcpcd-${INTERFACE}.{pid,cache} >/dev/null 2>&1
+ rm -f "/var/run/dhcpcd-${INTERFACE}".{pid,cache} >/dev/null 2>&1
# If using own dns, tell dhcpcd to NOT replace resolv.conf
[[ -n "$DNS" ]] && DHCP_OPTIONS="-C resolv.conf $DHCP_OPTIONS"
@@ -61,13 +61,13 @@ ethernet_up() {
static)
if [[ -n "$ADDR" ]]; then
report_debug ethernet_iproute_up ip addr add "$ADDR/24" brd + dev "$INTERFACE"
- if ! ip addr add ${ADDR}/24 brd + dev $INTERFACE; then
+ if ! ip addr add "${ADDR}/24" brd + dev "$INTERFACE"; then
report_iproute "Could not configure interface"
fi
fi
if [[ -n "$GATEWAY" ]]; then
report_debug ethernet_iproute_up ip route add default via "$GATEWAY"
- if ! ip route add default via $GATEWAY; then
+ if ! ip route add default via "$GATEWAY"; then
report_iproute "Adding gateway $GATEWAY failed"
fi
fi
@@ -90,7 +90,7 @@ ethernet_up() {
# Set hostname
if [[ -n "$HOSTNAME" ]]; then
report_debug ethernet_iproute_up hostname "$HOSTNAME"
- if ! hostname $HOSTNAME; then
+ if ! hostname "$HOSTNAME"; then
report_iproute "Cannot set hostname"
fi
fi
@@ -102,7 +102,7 @@ ethernet_up() {
[[ -n "$SEARCH" ]] && echo "search $SEARCH" >>/etc/resolv.conf
if [[ -n "$DNS" ]]; then
- for dns in ${DNS[@]}; do
+ for dns in "${DNS[@]}"; do
echo "nameserver $dns" >>/etc/resolv.conf
done
fi
@@ -111,10 +111,10 @@ ethernet_up() {
}
ethernet_down() {
- load_profile $1
+ load_profile "$1"
if [[ "$IP" == "dhcp" ]]; then
- if [[ -f /var/run/dhcpcd-${INTERFACE}.pid ]]; then
+ if [[ -f "/var/run/dhcpcd-${INTERFACE}.pid" ]]; then
report_debug ethernet_iproute_down dhcpcd -qx "$INTERFACE"
dhcpcd -qx "$INTERFACE" &>/dev/null
fi
@@ -134,6 +134,6 @@ ethernet_status() {
fi
}
-ethernet_$1 $2
+ethernet_$1 "$2"
exit $?
# vim: set ts=4 et sw=4:
diff --git a/src/connections/ppp b/src/connections/ppp
index c59db40..c50fee1 100644
--- a/src/connections/ppp
+++ b/src/connections/ppp
@@ -3,11 +3,11 @@
ppp_up() {
- load_profile $1
+ load_profile "$1"
[[ -z "$PEER" ]] && PEER="provider"
[[ -z "$PPP_TIMEOUT" ]] && PPP_TIMEOUT=30
- /usr/sbin/pppd call $PEER updetach child-timeout $PPP_TIMEOUT linkname $PEER
+ /usr/sbin/pppd call "$PEER" updetach child-timeout "$PPP_TIMEOUT" linkname "$PEER"
if [[ $? -ne 0 ]]; then
report_fail "Couldn't make pppd connection."
@@ -16,10 +16,10 @@ ppp_up() {
}
ppp_down() {
- load_profile $1
- kill $(head -1 /var/run/ppp-$(basename $PEER).pid)
+ load_profile "$1"
+ kill $(head -1 "/var/run/ppp-$(basename $PEER).pid")
}
-ppp_$1 $2
+ppp_$1 "$2"
exit $?
# vim: set ts=4 et sw=4:
diff --git a/src/connections/wireless b/src/connections/wireless
index c50acfa..a0191b6 100644
--- a/src/connections/wireless
+++ b/src/connections/wireless
@@ -16,11 +16,11 @@ rfkill_from_name() {
wireless_up() {
- load_profile $1
+ load_profile "$1"
[[ -n "$2" ]] && ESSID="$2" # JP: use the literal ESSID (though currently we only interpret wireless-dbus ESSIDs as regexps)
- . ${SUBR_DIR}/8021x
- . ${SUBR_DIR}/wireless
+ . "${SUBR_DIR}/8021x"
+ . "${SUBR_DIR}/wireless"
# If rfkill is specified, enable device.
if [[ -n "$RFKILL_NAME" ]]; then
@@ -46,9 +46,9 @@ wireless_up() {
# Most drivers (mac80211) need mode set before device is brought up
# Drivers generally default to managed, but set this to be sure.
- if [[ $(iwgetid -sm $INTERFACE) -ne Managed ]]; then
+ if [[ $(iwgetid -sm "$INTERFACE") -ne Managed ]]; then
report_debug wireless_up iwconfig "$INTERFACE" mode managed
- iwconfig $INTERFACE mode managed
+ iwconfig "$INTERFACE" mode managed
fi
report_debug wireless_up ifup
@@ -63,7 +63,7 @@ wireless_up() {
fi
fi
- if checkyesno ${SCAN:-no}; then
+ if checkyesno "${SCAN:-no}"; then
report_debug wireless_up scanning
local OLDESSID="$ESSID"
if [[ -n "$AP" ]]; then
@@ -81,13 +81,13 @@ wireless_up() {
# Manually set iwconfig options
if [[ "$IWCONFIG" ]]; then
report_debug wireless_up iwconfig "$INTERFACE" $IWCONFIG
- iwconfig $INTERFACE $IWCONFIG
+ iwconfig "$INTERFACE" $IWCONFIG
fi
# Set to 'none' if not set
[[ -z "$SECURITY" ]] && SECURITY="none"
- case $SECURITY in
+ case "$SECURITY" in
wep|none)
# 'none' uses iwconfig like wep. Use sane default if WEP_OPTS=""
if [[ -z "$WEP_OPTS" ]]; then
@@ -123,7 +123,7 @@ wireless_up() {
fi
report_debug ethernet_up wep_check
- if ! wep_check $INTERFACE $TIMEOUT; then
+ if ! wep_check "$INTERFACE" "$TIMEOUT"; then
report_fail "WEP Association Failed"
return 1
fi
@@ -169,7 +169,7 @@ wireless_up() {
fi
;;
wpa-config)
- . ${SUBR_DIR}/8021x
+ . "${SUBR_DIR}/8021x"
[[ -z "$WPA_CONF" ]] && WPA_CONF="/etc/wpa_supplicant.conf" # defaults
[[ -z "$WPA_OPTS" ]] && WPA_OPTS="-Dwext"
report_debug wireless_up start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_OPTS"
@@ -186,27 +186,27 @@ wireless_up() {
esac
conn=ethernet
- checkyesno ${IPROUTE:-no} && conn=ethernet-iproute
- if ! ${CONN_DIR}/$conn up $1; then
- wireless_down $1 YES
+ checkyesno "${IPROUTE:-no}" && conn=ethernet-iproute
+ if ! "${CONN_DIR}/$conn" up "$1"; then
+ wireless_down "$1" YES
return 1
fi
}
wireless_down() {
- PROFILE=$1 NOETHERNETDOWN=$2
- load_profile $PROFILE
- . ${SUBR_DIR}/8021x
- if ! checkyesno $NOETHERNETDOWN; then
+ local PROFILE="$1" NOETHERNETDOWN="$2"
+ load_profile "$PROFILE"
+ . "${SUBR_DIR}/8021x"
+ if ! checkyesno "$NOETHERNETDOWN"; then
conn=ethernet
- checkyesno ${IPROUTE:-no} && conn=ethernet-iproute
- $CONN_DIR/$conn down $PROFILE
+ checkyesno "${IPROUTE:-no}" && conn=ethernet-iproute
+ "$CONN_DIR/$conn" down "$PROFILE"
fi
report_debug wireless_down stop_wpa "$INTERFACE"
- stop_wpa $INTERFACE
+ stop_wpa "$INTERFACE"
[[ "$SECURITY" == "wpa" ]] && rm -rf "/tmp/wpa.${PROFILE// /}" # remove tmp wpa config
report_debug wireless_down iwconfig "$INTERFACE" essid off key off
- iwconfig $INTERFACE essid off key off &> /dev/null
+ iwconfig "$INTERFACE" essid off key off &> /dev/null
# respects quirk nodown---is that appropriate?
# wasn't this already called in ethernet_down? but does the call there respect quirk nodown?
# this adds a flush call as well---is that appropriate?
@@ -214,11 +214,11 @@ wireless_down() {
# If rfkill is specified, disable device.
if [[ -n "$RFKILL_NAME" ]]; then
- path=$(rfkill_from_name $RFKILL_NAME)
+ path=$(rfkill_from_name "$RFKILL_NAME")
if [[ $? -ne 0 ]]; then
report_fail "no rfkill switch with the name $RFKILL_NAME";
fi
- echo 0 > ${path}/state
+ echo 0 > "${path}/state"
fi
}