From d828b580d07b250567bc611c8083095ed1a53915 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Thu, 23 Feb 2012 13:35:20 +0100 Subject: 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). --- rc.d/net-auto-wireless | 2 +- rc.d/net-profiles | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'rc.d') 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 ;; -- cgit v1.2.3-24-g4f1b