summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/netcfg-menu18
1 files changed, 6 insertions, 12 deletions
diff --git a/scripts/netcfg-menu b/scripts/netcfg-menu
index 1ca5e32..86b5d09 100755
--- a/scripts/netcfg-menu
+++ b/scripts/netcfg-menu
@@ -29,7 +29,6 @@ fi
[[ -n "$NETWORKS_MENU_DEFAULT" ]] && DEFAULT="$NETWORKS_MENU_DEFAULT"
# if no default yet, use the first entry
[[ -z "$DEFAULT" ]] && DEFAULT="${profiles[0]}"
-ANSWER=$(mktemp --tmpdir menu.XXXXXXXX) || exit 1
# Set timeout
if [[ -z "$1" ]]; then
@@ -39,19 +38,14 @@ else
fi
# Display Dialog
-dialog --timeout "$TIMEOUT" --default-item "$DEFAULT" \
- --menu "Select the network profile you wish to use" \
- 13 50 6 "${profiles[@]}" 2> "$ANSWER"
-
+PROFILE=$(dialog --timeout "$TIMEOUT" --default-item "$DEFAULT" --stdout \
+ --menu 'Select the network profile you wish to use' \
+ 13 50 6 "${profiles[@]}")
ret=$?
-
case $ret in
1) ;; # Cancel - do nothing
- 255) # timeout - use default
- PROFILE=$DEFAULT;;&
- 0) # User selection
- read PROFILE < "$ANSWER";;&
- 255|0)
+ 255|0) # Timeout (use default) or user selection
+ [[ -z "$PROFILE" ]] && PROFILE="$DEFAULT"
profile_up "$PROFILE"
ret=$?
(( ret == 0 )) && echo "$PROFILE" > "$STATE_DIR/menu"
@@ -60,7 +54,7 @@ case $ret in
exit_err "Abnormal ret code from dialog: $ret"
;;
esac
-rm -f "$ANSWER" # JP: add -f
+
exit $ret # JP: exit with caught $?
# vim: ft=sh ts=4 et sw=4: