diff options
author | James Rayner <james@archlinux.org> | 2009-02-16 11:09:06 +0100 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-02-16 11:09:06 +0100 |
commit | 371cd06f36328ba0ddb75fe64102e8fc232a7fd3 (patch) | |
tree | 1584bb6d4eafe2cd2ee257d9c9b1d3ef1cc67a58 /src/connections | |
parent | cfcf836b94c5f3b520f0022942b1932c566eefdb (diff) | |
download | netctl-371cd06f36328ba0ddb75fe64102e8fc232a7fd3.tar.gz netctl-371cd06f36328ba0ddb75fe64102e8fc232a7fd3.tar.xz |
various fixes, and new quirk 'noacheck'
Diffstat (limited to 'src/connections')
-rw-r--r-- | src/connections/ethernet | 12 | ||||
-rw-r--r-- | src/connections/ethernet-iproute | 4 | ||||
-rw-r--r-- | src/connections/wireless | 20 |
3 files changed, 19 insertions, 17 deletions
diff --git a/src/connections/ethernet b/src/connections/ethernet index 12b9e49..042b32b 100644 --- a/src/connections/ethernet +++ b/src/connections/ethernet @@ -34,7 +34,7 @@ ethernet_up() { if checkyesno "${DHCLIENT:-no}"; then rm -r /var/run/dhclient-${INTERFACE}.pid >/dev/null 2>&1 if ! dhclient -q -e TIMEOUT="${DHCP_TIMEOUT:-10}" -pf /var/run/dhclient-${INTERFACE}.pid $INTERFACE; then - err_append "DHCP IP lease attempt failed" + err_append "DHCP IP lease attempt failed." return 1 fi else @@ -44,7 +44,7 @@ ethernet_up() { [[ -n "$DNS1" ]] && DHCP_OPTIONS="-C resolv.conf $DHCP_OPTIONS" # Start dhcpcd if ! dhcpcd -qL -t "${DHCP_TIMEOUT:-10}" $DHCP_OPTIONS "$INTERFACE"; then - err_append "DHCP IP lease attempt failed" + err_append "DHCP IP lease attempt failed." return 1 fi fi @@ -52,20 +52,20 @@ ethernet_up() { ;; static) if ! ifconfig "$INTERFACE" $IFOPTS up; then - err_append "could not bring interface up" + err_append "Bringing interface up failed." return 1 fi # bring up the default route (gateway) if [[ -n "$GATEWAY" ]]; then if ! route add default gw $GATEWAY; then - err_append "adding gateway failed" + err_append "Adding gateway failed." return 1 fi fi ;; *) - err_append "IP must be either 'dhcp' or 'static'" + err_append "IP=\"\" must be either 'dhcp' or 'static'." return 1 ;; esac @@ -73,7 +73,7 @@ ethernet_up() { # set the hostname if [[ -n "$HOSTNAME" ]]; then if ! hostname "$HOSTNAME"; then - err_append "cannot set hostname" + err_append "Setting hostname failed." return 1 fi fi diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute index a491419..a960e1d 100644 --- a/src/connections/ethernet-iproute +++ b/src/connections/ethernet-iproute @@ -46,7 +46,6 @@ ethernet_up() { if ! dhcpcd -qL -t ${DHCP_TIMEOUT:-10} $DHCP_OPTIONS $INTERFACE; then error "DHCP IP lease attempt failed" - return 1 fi ;; static) @@ -58,13 +57,11 @@ ethernet_up() { if [[ -n "$GATEWAY" ]]; then if ! ip route add default via $GATEWAY; then error "Adding gateway failed" - return 1 fi fi ;; *) error "Profile error: IP must be either 'dhcp' or 'static'" - return 1 ;; esac @@ -81,7 +78,6 @@ ethernet_up() { if [[ -n "$HOSTNAME" ]]; then if ! hostname $HOSTNAME; then error "Cannot set hostname" - return 1 fi fi diff --git a/src/connections/wireless b/src/connections/wireless index 04c5819..e8ff2e5 100644 --- a/src/connections/wireless +++ b/src/connections/wireless @@ -7,8 +7,9 @@ wireless_up() { . ${SUBR_DIR}/wireless + if [[ ! -d /sys if [[ ! -d /sys/class/net/$INTERFACE/wireless ]]; then - err_append "Interface $INTERFACE is not a wireless interface" + err_append "$INTERFACE is not a valid wireless interface." return 1 fi @@ -30,7 +31,7 @@ wireless_up() { [[ ! "$SCAN" ]] && SCAN="no" if checkyesno $SCAN; then if ! find_essid $INTERFACE "$ESSID"; then - err_append "Network unavailable" + err_append "Network not present." return 1 fi fi @@ -54,15 +55,20 @@ wireless_up() { quirk "predown" && ifconfig $INTERFACE down if ! eval iwconfig $INTERFACE $WEP_OPTS; then - err_append "Could not set wireless configuration" + err_append "Could not set wireless configuration." return 1 fi quirk "postsleep" && sleep 1 quirk "postscan" && sleep 1 && iwlist $INTERFACE scan &>/dev/null quirk "predown" && ifconfig $INTERFACE up - - wep_check $INTERFACE $TIMEOUT|| return 1 + + # Some devices appear to not associate until DHCP is run. + if quirk "noacheck"; then + sleep ${WIRELESS_TIMEOUT:-20} + else + wep_check $INTERFACE $TIMEOUT|| return 1 + fi ;; wpa) . ${SUBR_DIR}/8021x @@ -72,14 +78,14 @@ wireless_up() { local WPA_CONF="/tmp/wpa.${1// /}" # substitute spaces out echo "ctrl_interface=/var/run/wpa_supplicant" >> $WPA_CONF - echo "ctrl_interface_group=0" >> $WPA_CONF + echo "ctrl_interface_group=wheel" >> $WPA_CONF chmod 600 $WPA_CONF # Generate configuration if [[ "${#KEY}" == "64" ]]; then echo -e 'network={ \nssid="$ESSID" \npsk=$KEY \n}'> $WPA_CONF elif ! echo "$KEY" | wpa_passphrase "$ESSID" >> $WPA_CONF; then - err_append "Configuration generation failed: `cat $WPA_CONF`" + err_append "Configuration generation failed. $(cat $WPA_CONF)" return 1 fi |