summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémy Oudompheng <remy@archlinux.org>2011-06-19 21:46:47 +0200
committerRémy Oudompheng <remy@archlinux.org>2011-06-19 21:46:47 +0200
commit5ac9b45fe392a70c7325aac65ff02f572cdf1cff (patch)
treefaba08a0b514d1668acfb6995d9887a7eda62886
parent43926c44661a9f8499b3fb9775e1cfdd4aef2bdf (diff)
downloadnetctl-5ac9b45fe392a70c7325aac65ff02f572cdf1cff.tar.gz
netctl-5ac9b45fe392a70c7325aac65ff02f572cdf1cff.tar.xz
Add /etc/conf.d/netcfg for net-auto-wireless configuration.
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
-rw-r--r--Makefile1
-rw-r--r--NEWS2
-rw-r--r--config/netcfg6
-rwxr-xr-xcontrib/pm-utils.handler18
-rw-r--r--src-wireless/netcfg-auto-wireless7
-rwxr-xr-xwpa_actiond/net-auto-wireless6
6 files changed, 29 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index a0074e3..02f6695 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,7 @@ install:
$(DESTDIR)/usr/share/man/{man5,man8} \
install -d $(DESTDIR)/lib/systemd/system
# Documentation
+ install -m644 config/netcfg $(DESTDIR)/etc/conf.d/netcfg
install -m644 examples/* $(DESTDIR)/etc/network.d/examples/
install -m644 src/iftab $(DESTDIR)/etc/iftab
install -m644 man/*.8 $(DESTDIR)/usr/share/man/man8
diff --git a/NEWS b/NEWS
index 7ed9aec..313ef93 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ version 2.6
- add support for IPv6 configuration (FS#18699)
- add support for static routes configuration (FS#18700)
- add support for creating tun/tap interfaces (FS#15049)
+- add configuration file /etc/conf.d/netcfg for net-auto-wireless
+- add support for restricting automatic profiles (FS#23169)
- bridge: add support for several brctl options (FS#16625)
- wireless: add support for explicit BSSID (FS#24582)
- wireless: add support for ad-hoc connections (FS#19683)
diff --git a/config/netcfg b/config/netcfg
new file mode 100644
index 0000000..055a87d
--- /dev/null
+++ b/config/netcfg
@@ -0,0 +1,6 @@
+## Define to the name of your wireless interface for net-auto-wireless
+WIRELESS_INTERFACE="wlan0"
+
+## List of profiles that can be started by net-auto-wireless
+## defaults to the list of all wireless profiles
+#AUTO_PROFILES="profile1 profile2"
diff --git a/contrib/pm-utils.handler b/contrib/pm-utils.handler
index b8cb568..0ad87b3 100755
--- a/contrib/pm-utils.handler
+++ b/contrib/pm-utils.handler
@@ -4,6 +4,10 @@
[[ -f /usr/lib/network/network ]] || exit $NA
. /usr/lib/network/network
+. /etc/rc.conf
+. /etc/conf.d/netcfg
+
+WIRELESS_INTERFACE=${WIRELESS_INTERFACE:-wlan0}
auto_resume()
{
@@ -32,23 +36,23 @@ case "$1" in
fi
;;
thaw|resume)
- if [ -f "$STATE_DIR/interface/wlan0" ]; then
+ if [ -f "$STATE_DIR/interface/${WIRELESS_INTERFACE}" ]; then
report_notify "resuming all interfaces..."
- auto_resume wlan0
+ auto_resume ${WIRELESS_INTERFACE}
else
report_notify "resuming all interfaces except wireless..."
- all_resume wlan0
+ all_resume ${WIRELESS_INTERFACE}
fi
;;
radio_off)
report_notify "suspending wireless interface..."
- interface_suspend wlan0 no
- set_iface disabled wlan0
- bring_interface forcedown wlan0
+ interface_suspend ${WIRELESS_INTERFACE} no
+ set_iface disabled ${WIRELESS_INTERFACE}
+ bring_interface forcedown ${WIRELESS_INTERFACE}
;;
radio_on)
report_notify "resuming wireless interface..."
- auto_resume wlan0
+ auto_resume ${WIRELESS_INTERFACE}
if [ -x /etc/pm/power.d/??wifi ]; then
/usr/bin/on_ac_power # this is in pm-utils
case $? in
diff --git a/src-wireless/netcfg-auto-wireless b/src-wireless/netcfg-auto-wireless
index b915272..a3e3fb9 100644
--- a/src-wireless/netcfg-auto-wireless
+++ b/src-wireless/netcfg-auto-wireless
@@ -4,6 +4,7 @@
. /usr/lib/network/network
. $SUBR_DIR/rfkill
. $SUBR_DIR/8021x
+. /etc/conf.d/netcfg
# wifi_auto
# autoconnect wireless interface
@@ -30,9 +31,11 @@ wifi_auto()
local found_profile
+ [ -z "$AUTO_PROFILES" ] && AUTO_PROFILES=$(list_profiles)
+
# JP: add ability to use AP instead of ESSID
while read ap essid; do
- while read network; do
+ echo $AUTO_PROFILES | while read network; do
(
unset CONNECTION INTERFACE AP ESSID
load_profile "$network"
@@ -58,7 +61,7 @@ wifi_auto()
1) found_profile="$network"
;;
esac
- done < <(list_profiles) # avoid subshell we'd get by piping list_profiles to while read
+ done
done < "$networks" # avoid subshell; list_networks returns name of a tmp file
rm -f "$networks" # shouldn't we delete the tmp file?
diff --git a/wpa_actiond/net-auto-wireless b/wpa_actiond/net-auto-wireless
index 5e93a8f..d6a3c44 100755
--- a/wpa_actiond/net-auto-wireless
+++ b/wpa_actiond/net-auto-wireless
@@ -3,14 +3,16 @@
. /etc/rc.conf
. /etc/rc.d/functions
. /usr/lib/network/globals
+. /etc/conf.d/netcfg
if [[ ! -x /usr/sbin/wpa_actiond ]]; then
echo "Please install 'wpa_actiond' to use net-auto-wireless"
exit 1
-fi
+fi
if [ -z "${WIRELESS_INTERFACE}" ]; then
- echo "No interface name set. Set it by adding WIRELESS_INTERFACE=\"your_interface\" to rc.conf"
+ echo "No interface name set. Add to /etc/conf.d/netcfg a line"
+ echo " WIRELESS_INTERFACE=\"your_interface\""
exit 1
fi