From b6964c5f37deb1bd7a265268ba8abf59c01e7694 Mon Sep 17 00:00:00 2001 From: James Rayner Date: Sun, 31 Jan 2010 10:03:29 +1100 Subject: Fix FS#17406, FS#17307 --- src/net-profiles | 36 +++++++++++++++--------------------- src/netcfg | 2 -- src/network | 4 +--- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/net-profiles b/src/net-profiles index ccb14ee..fe57762 100644 --- a/src/net-profiles +++ b/src/net-profiles @@ -32,32 +32,26 @@ case "$1" in add_daemon net-profiles exit 0 fi + elif [[ $NETWORKS = "menu" ]]; then + if /usr/bin/netcfg-menu "$NETWORKS_MENU_TIMEOUT"; then + mv "$STATE_DIR"/menu "$STATE_DIR"/net-profiles + add_daemon net-profiles + exit 0 + fi else # No NET= passed at boot, go to NETWORKS=() for network in "${NETWORKS[@]}"; do - case "$network" in - menu) # Pull up menu of networks - if /usr/bin/netcfg-menu "$NETWORKS_MENU_TIMEOUT"; then - mv "$STATE_DIR"/{menu,net-profiles} # JP: user may want to disconnect profile by calling net-profiles stop - add_daemon net-profiles - exit 0 - fi - break # if netcfg-menu was called but failed: exit for loop - ;; - *) # Either interface or profile - if [[ "$network" = "${network#!}" ]]; then # otherwise profile - if /usr/bin/netcfg2 check-iface "$network"; then - echo "$network" > "$STATE_DIR/net-profiles" # JP: user may want to disconnect profile by calling net-profiles stop - add_daemon net-profiles - exit 0 - fi - fi - ;; - esac + if [[ "$network" = "${network#!}" ]]; then + if /usr/bin/netcfg2 check-iface "$network"; then + echo "$network" > "$STATE_DIR/net-profiles" + add_daemon net-profiles + fi + fi done fi - - exit_err "No profile started." # JP: don't add_daemon unless we were successful (above) + if [[ ! -f "$STATE_DIR"/net-profiles ]]; then + exit_err "No profile started." # JP: don't add_daemon unless we were successful (above) + fi ;; stop) if ck_daemon net-profiles; then diff --git a/src/netcfg b/src/netcfg index 31789d5..8b5a743 100644 --- a/src/netcfg +++ b/src/netcfg @@ -40,8 +40,6 @@ case "$1" in usage exit 0;; list|-l) - echo "Available Profiles" - echo "------------------" list_profiles exit 0;; current|-s|status) diff --git a/src/network b/src/network index 70f639f..5bb4182 100644 --- a/src/network +++ b/src/network @@ -37,9 +37,7 @@ load_profile() # take all registered profiles down all_down() { - find "$STATE_DIR/profiles/" -maxdepth 1 -type f -printf '%f\n' \ - | while read prof; do - # the pipe to while read... creates a subshell + for prof in $(find "$STATE_DIR/profiles/" -maxdepth 1 -type f -printf '%f\n'); do profile_down "$prof" done } -- cgit v1.2.3-24-g4f1b