summaryrefslogtreecommitdiffstats
path: root/src/netctl-auto
diff options
context:
space:
mode:
authorSebastian Wicki <gandro@gmx.net>2014-02-02 16:55:58 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2014-03-01 20:11:26 +0100
commitde8c80f6748f1202d5b28594f4b8195417f4e219 (patch)
tree8e9329a9b39fd2e21f86eea9933c6793d07845e5 /src/netctl-auto
parent3b77f8666f19ca2ed1fc242d05d88706b8261863 (diff)
downloadnetctl-de8c80f6748f1202d5b28594f4b8195417f4e219.tar.gz
netctl-de8c80f6748f1202d5b28594f4b8195417f4e219.tar.xz
Change how netctl-auto looks for active interfaces
Instead of searching for wpa_actiond pid files, the netctl-auto utility now looks for running systemd netctl-auto units.
Diffstat (limited to 'src/netctl-auto')
-rwxr-xr-xsrc/netctl-auto15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/netctl-auto b/src/netctl-auto
index 5cf104b..4f53f75 100755
--- a/src/netctl-auto
+++ b/src/netctl-auto
@@ -24,10 +24,11 @@ Commands:
END
}
-## Print a list of interfaces for which wpa_actiond is active
-list_actiond_interfaces() {
- find "$STATE_DIR" -maxdepth 1 -type f -name 'wpa_actiond_*.pid' \
- -exec basename -s ".pid" -a {} + | cut -d'_' -f3-
+## Print a list of interfaces for which netctl-auto is active
+list_netctl_auto_interfaces() {
+ systemctl --full --no-legend --no-pager \
+ --type=service --state=running list-units | \
+ sed -nr 's/^netctl-auto@([[:alnum:]]+).*/\1/p'
}
## List all profiles available to the WPA supplicant
@@ -38,7 +39,7 @@ list_actiond_interfaces() {
## PROFILE.. profile name, may contain spaces
list_wpa_profiles() {
local interface
- for interface in $(list_actiond_interfaces); do
+ for interface in $(list_netctl_auto_interfaces); do
local id ssid bssid flags
while IFS=$'\t' read -r id ssid bssid flags; do
local flag="e"
@@ -82,7 +83,7 @@ profile_enable_disable() {
if [ -n "$profile" ]; then
read -r interfaces id < <(get_wpa_network_id "$profile") || return 1
else
- interfaces=$(list_actiond_interfaces)
+ interfaces=$(list_netctl_auto_interfaces)
fi
case $action in
@@ -148,7 +149,7 @@ switch_to() {
## List currently active profiles
current() {
local interface
- for interface in $(list_actiond_interfaces); do
+ for interface in $(list_netctl_auto_interfaces); do
local state=$(wpa_get_state "$interface")
if [[ "$state" == "COMPLETED" ]]; then
wpa_call "$interface" status | sed -n 's/^id_str=//p'