summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-11-07 01:56:09 +0100
committerJames Rayner <james@archlinux.org>2009-11-07 01:56:09 +0100
commit77a2e3798ce3197146315754e813e2b902f3f0b5 (patch)
treea3d48b9302eb6e18924984ee166f5870a6e8a242
parentd176d9fa5013a0c4a8b25754cec053c24a0d83d1 (diff)
downloadnetctl-77a2e3798ce3197146315754e813e2b902f3f0b5.tar.gz
netctl-77a2e3798ce3197146315754e813e2b902f3f0b5.tar.xz
Prevent corrupting wpa-config WPA_CONF, rfkill on stop
-rwxr-xr-xwpa_actiond/netcfg-wpa_actiond13
1 files changed, 11 insertions, 2 deletions
diff --git a/wpa_actiond/netcfg-wpa_actiond b/wpa_actiond/netcfg-wpa_actiond
index 32fd42d..a582353 100755
--- a/wpa_actiond/netcfg-wpa_actiond
+++ b/wpa_actiond/netcfg-wpa_actiond
@@ -15,6 +15,9 @@ case $1 in
stop)
stop_wpa $2
kill $(cat "/var/run/wpa_actiond_${2}.pid")
+ if [[ -n "$RFKILL" ]]; then # Enable radio if necessary
+ set_rf_state "$interface" down || exit $?
+ fi
exit
;;
*)
@@ -32,6 +35,10 @@ fi
# Load interface specific config
[[ -f "$IFACE_DIR/$interface" ]] && source "$IFACE_DIR/$interface"
+if [[ -f "$CONN_DIR/interfaces/$interface" ]]; then
+ netcfg -i $interface
+fi
+
if [[ -n "$RFKILL" ]]; then # Enable radio if necessary
set_rf_state "$interface" up || exit $?
fi
@@ -45,9 +52,11 @@ for profile in $(list_profiles); do
[[ $CONNECTION != "wireless" ]] && exit 1
[[ $INTERFACE != $interface ]] && exit 1
-
+ # Exclude wpa-config, the wpa_conf is 'complete' and doesn't fit in this scheme
+ [[ $SECURITY == "wpa-config" ]] && exit 1
+
config=$(make_wpa_config)
-
+
echo -e "network={ \n$config \nid_str=\"$profile\" \n}" >> $WPA_CONF
)
done