summaryrefslogtreecommitdiffstats
path: root/rc.d
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 /rc.d
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).
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/net-auto-wireless2
-rwxr-xr-xrc.d/net-profiles17
2 files changed, 14 insertions, 5 deletions
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
;;