summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-02-27 17:11:21 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2012-02-27 17:11:21 +0100
commit8d1c5e8ec6b637015e84bbb154ece9065c59f1c5 (patch)
tree573516ed0a5a8af5ba0a50b706af63d0ae4eef5d
parentd31febe0879d156c05dc47bb8ecbdf2cfee92238 (diff)
downloadnetctl-8d1c5e8ec6b637015e84bbb154ece9065c59f1c5.tar.gz
netctl-8d1c5e8ec6b637015e84bbb154ece9065c59f1c5.tar.xz
Reconnect syntax for interfaces (FS#28196)
It is now possible to reconnect based on the name of the interface.
-rw-r--r--AUTHORS1
-rwxr-xr-xscripts/netcfg3
-rwxr-xr-xscripts/netcfg-wpa_actiond4
-rw-r--r--src/network26
4 files changed, 26 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index 3ca9188..b36cb3a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,4 +4,5 @@ Kyle Fuller <inbox@kylefuller.co.uk>
Andrea Scarpino <andrea@archlinux.org>
Thomas Bächler <thomas@archlinux.org>
Rémy Oudompheng <remy@archlinux.org>
+Jouke Witteveen <j.witteveen@gmail.com>
diff --git a/scripts/netcfg b/scripts/netcfg
index 9d341e5..1f734c7 100755
--- a/scripts/netcfg
+++ b/scripts/netcfg
@@ -24,6 +24,7 @@ usage()
echo "-i, iface-down Take down profile active on specified interface"
echo "-l, list List all available profiles"
echo "-r, reconnect Disconnect and reconnect specified profile"
+ echo "-R, iface-recon Reconnect profile active on specified interface"
echo "-u, up Start specified profile"
echo "-v, version Output version information and exit"
echo " all-resume Resume previously suspended profiles and reconnect them"
@@ -80,6 +81,8 @@ case "$1" in
-r|reconnect)
profile_down "$2"
profile_up "$2";;
+ -R|iface-recont)
+ interface_reconnect "$2";;
all-resume)
all_resume;;
all-suspend)
diff --git a/scripts/netcfg-wpa_actiond b/scripts/netcfg-wpa_actiond
index bb144c3..2e402df 100755
--- a/scripts/netcfg-wpa_actiond
+++ b/scripts/netcfg-wpa_actiond
@@ -67,9 +67,7 @@ fi | while read profile; do
[[ -z "$SECURITY" ]] && SECURITY="none"
[[ $SECURITY == "wpa-config" ]] && exit 1
- config=$(make_wpa_config)
-
- echo -e "network={ \n$config \nid_str=\"$profile\" \n}" >> $WPA_CONF
+ echo -e "network={ \n$(make_wpa_config) \nid_str=\"$profile\" \n}" >> $WPA_CONF
)
done
diff --git a/src/network b/src/network
index e1a57a2..5823411 100644
--- a/src/network
+++ b/src/network
@@ -265,12 +265,28 @@ quirk() {
#
interface_down()
{
- local status=$(check_iface "$1")
- case "$status" in
- disabled) return 0 ;;
- "") return 0 ;;
+ local profile=$(check_iface "$1")
+ case "$profile" in
+ ""|disabled) return 0 ;;
external) return 1 ;;
- *) profile_down "$status" ;;
+ *) profile_down "$profile" ;;
+ esac
+}
+
+
+# interface_reconnect interface
+# reconnects the profile active on interface
+interface_reconnect()
+{
+ local profile=$(check_iface "$1")
+ case "$profile" in
+ ""|disabled|external)
+ return 1
+ ;;
+ *)
+ profile_down "$profile"
+ profile_up "$profile"
+ ;;
esac
}