summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net-profiles36
-rw-r--r--src/netcfg2
-rw-r--r--src/network4
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
}