summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-02-23 13:35:20 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2012-02-23 13:35:20 +0100
commitd828b580d07b250567bc611c8083095ed1a53915 (patch)
tree9737de85d84b46d80ad4713bba5065a968933211
parent7ba4e6face203dd9c0dcef82c9be0d2e436d571a (diff)
downloadnetctl-d828b580d07b250567bc611c8083095ed1a53915.tar.gz
netctl-d828b580d07b250567bc611c8083095ed1a53915.tar.xz
Add backgrounding functionality to net-profiles
Known from the DAEMONS syntax in rc.conf, it is now possible to start netcfg profiles in the background. This fixes FS#23934 which was reported by Andrej Podzimek (andrej).
-rw-r--r--docs/features.txt4
-rwxr-xr-xrc.d/net-auto-wireless2
-rwxr-xr-xrc.d/net-profiles17
-rw-r--r--src-wireless/net-auto2
4 files changed, 17 insertions, 8 deletions
diff --git a/docs/features.txt b/docs/features.txt
index 3a7f3c3..8120baf 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -23,9 +23,9 @@ For more options, see ''netcfg help''
## Start a specific list of profiles on boot
-net-profiles allows you to start some profiles on boot. Specify the profiles you want netcfg to start in the NETWORKS line in /etc/rc.conf. For example:
+net-profiles allows you to start some profiles on boot. Specify the profiles you want netcfg to start (in this order) in the NETWORKS line in /etc/conf.d/netcfg. Prefix a profile with a @ to start it in the background. For example:
- NETWORKS=(home mywireless)
+ NETWORKS=(@adsl @mywireless lan)
To run on boot, add 'net-profiles' to your DAEMONS line.
diff --git a/rc.d/net-auto-wireless b/rc.d/net-auto-wireless
index d6a3c44..a03097b 100755
--- a/rc.d/net-auto-wireless
+++ b/rc.d/net-auto-wireless
@@ -23,7 +23,7 @@ case "$1" in
fi
# Ensure any device renaming has occurred as intended
for daemon in "${DAEMONS[@]}"; do
- if [[ "$daemon" = "${daemon#!}" && "$daemon" = "net-rename" ]]; then
+ if [[ "$daemon" = "net-rename" ]]; then
if ck_daemon net-rename; then
/etc/rc.d/net-rename start
fi
diff --git a/rc.d/net-profiles b/rc.d/net-profiles
index 15a1a4c..f7770ee 100755
--- a/rc.d/net-profiles
+++ b/rc.d/net-profiles
@@ -1,6 +1,7 @@
#!/bin/bash
. /usr/lib/network/globals
+. /etc/rc.conf
. /etc/conf.d/netcfg
case "$1" in
@@ -11,7 +12,7 @@ case "$1" in
# Ensure any device renaming has occurred as intended
for daemon in "${DAEMONS[@]}"; do
- if [[ "$daemon" = "${daemon#!}" && "$daemon" = "net-rename" ]]; then
+ if [[ "$daemon" = "net-rename" ]]; then
if ck_daemon net-rename; then
/etc/rc.d/net-rename start
fi
@@ -42,15 +43,23 @@ case "$1" in
else
# No NET= passed at boot, go to NETWORKS=()
for network in "${NETWORKS[@]}"; do
- if [[ "$network" = "${network#!}" ]]; then
+ if [[ "$network" = "${network#@}" ]]; then
if /usr/bin/netcfg2 check-iface "$network"; then
- echo "$network" >> "$STATE_DIR/net-profiles"
+ echo "$network" >> "$STATE_DIR/net-profiles"
add_daemon net-profiles
fi
+ else
+ # It is up to the user to make sure no backgrounded profile
+ # uses an interface that is used by another active profile.
+ if /usr/bin/netcfg2 "${network#@}"; then
+ echo "${network#@}" >> "$STATE_DIR/net-profiles"
+ add_daemon net-profiles
+ fi >/dev/null &
+ PROFILE_BKGD=1
fi
done
fi
- if [[ ! -f "$STATE_DIR"/net-profiles ]]; then
+ if [[ ! -f "$STATE_DIR"/net-profiles && -z "$PROFILE_BKGD" ]]; then
exit_err "No profile started." # JP: don't add_daemon unless we were successful (above)
fi
;;
diff --git a/src-wireless/net-auto b/src-wireless/net-auto
index 6c15f52..ca52b3e 100644
--- a/src-wireless/net-auto
+++ b/src-wireless/net-auto
@@ -9,7 +9,7 @@ case "$1" in
fi
# Ensure any device renaming has occurred as intended
for daemon in "${DAEMONS[@]}"; do
- if [[ "$daemon" = "${daemon#!}" && "$daemon" = "net-rename" ]]; then
+ if [[ "$daemon" = "net-rename" ]]; then
if ck_daemon net-rename; then
/etc/rc.d/net-rename start
fi