summaryrefslogtreecommitdiffstats
path: root/wpa_actiond
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-09-27 18:52:10 +0200
committerThomas Bächler <thomas@archlinux.org>2009-09-27 18:52:10 +0200
commit4cc58cd1f1e6b427f0519abd03377053622aae7c (patch)
treebd35cd11a71df4cf43f1f03a55523bd1c9020f87 /wpa_actiond
parent4b323e17b5ecb18bd3c0337edf4d17174310d27d (diff)
downloadnetctl-4cc58cd1f1e6b427f0519abd03377053622aae7c.tar.gz
netctl-4cc58cd1f1e6b427f0519abd03377053622aae7c.tar.xz
Add net-auto-wireless rc.d script for the wpa_actiond mode
Diffstat (limited to 'wpa_actiond')
-rwxr-xr-xwpa_actiond/net-auto-wireless56
1 files changed, 56 insertions, 0 deletions
diff --git a/wpa_actiond/net-auto-wireless b/wpa_actiond/net-auto-wireless
new file mode 100755
index 0000000..4f4c754
--- /dev/null
+++ b/wpa_actiond/net-auto-wireless
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+if [ -z "${WIRELESS_INTERFACE}" ]; then
+ echo "No interface name set. Set it by adding WIRELESS_INTERFACE=\"your_interface\" to rc.conf"
+ exit 1
+fi
+
+case "$1" in
+ start)
+ if ! ck_daemon net-auto-wireless; then
+ exit_stderr "net-auto-wireless has already been started: try \"/etc/rc.d/net-auto-wireless restart\""
+ fi
+ # Ensure any device renaming has occurred as intended
+ for daemon in "${DAEMONS[@]}"; do
+ if [[ "$daemon" = "${daemon#!}" && "$daemon" = "net-rename" ]]; then
+ if ck_daemon net-rename; then
+ /etc/rc.d/net-rename start
+ fi
+ fi
+ done
+
+ stat_busy "Starting netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}"
+ /usr/bin/netcfg-wpa_actiond "${WIRELESS_INTERFACE}" >/dev/null
+ if [ $? -eq 0 ]; then
+ add_daemon net-auto-wireless
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ if ! ck_daemon net-auto-wireless; then
+ stat_busy "Stopping netcfg auto-wireless mode for interface ${WIRELESS_INTERFACE}"
+ /usr/bin/netcfg-wpa_actiond stop "${WIRELESS_INTERFACE}" >/dev/null
+ if [ $? -eq 0 ]; then
+ rm_daemon net-auto-wireless
+ stat_done
+ else
+ stat_fail
+ fi
+ fi
+ ;;
+ restart)
+ "$0" stop
+ sleep 1
+ "$0" start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
+exit 0
+# vim: ft=sh ts=4 et sw=4: