summaryrefslogtreecommitdiffstats
path: root/src/netcfg-menu
diff options
context:
space:
mode:
authorRémy Oudompheng <remy@archlinux.org>2011-06-19 18:37:11 +0200
committerRémy Oudompheng <remy@archlinux.org>2011-06-19 18:43:40 +0200
commitfa94ee0e4b0489ee0ce57ccd4c8e03da10a81382 (patch)
treee8386f0e3122118a437a57abfe4d4d497ed99bf9 /src/netcfg-menu
parent99cb72a9e098e61407002d3339c0d842d580ccca (diff)
downloadnetctl-fa94ee0e4b0489ee0ce57ccd4c8e03da10a81382.tar.gz
netctl-fa94ee0e4b0489ee0ce57ccd4c8e03da10a81382.tar.xz
Move executable scripts to a separate scripts/ directory
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Diffstat (limited to 'src/netcfg-menu')
-rw-r--r--src/netcfg-menu69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/netcfg-menu b/src/netcfg-menu
deleted file mode 100644
index ff57005..0000000
--- a/src/netcfg-menu
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /bin/bash
-
-. /usr/lib/network/network
-
-if [[ ! -x /usr/bin/dialog ]]; then
- echo "Please install 'dialog' to use netcfg-menu"
- exit 1
-fi
-
-check_make_state_dir
-
-# JP: we'll use $STATE_DIR/menu to record what profile is being connected in this way
-rm -f "$STATE_DIR/menu"
-
-# Scan all profiles
-i=0
-# JP: change for prof to while read prof to avoid assumption that profile names are always single tokens (no spaces etc.)
-while read prof; do
- # if there is a profile called "main", Use as default
- [[ "$prof" = "main" ]] && DEFAULT="main"
- profiles[$i]="$prof"
- let i++
- profiles[$i]=$(. "$PROFILE_DIR/$prof"; echo "$DESCRIPTION")
- let i++
-done < <(list_profiles | sort) # JP: re-use list_profiles instead of duplicating it; avoid subshell we'd get by piping it to the while read...
-
-if [[ ${#profiles} -eq 0 ]]; then
- exit_err "No profiles were found in $PROFILE_DIR"
-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
- TIMEOUT="0"
-else
- TIMEOUT="$1"
-fi
-
-# Display Dialog
-dialog --timeout "$TIMEOUT" --default-item "$DEFAULT" \
- --menu "Select the network profile you wish to use" \
- 13 50 6 "${profiles[@]}" 2> "$ANSWER"
-
-ret=$?
-
-case $ret in
- 1) ;; # Cancel - do nothing
- 255) # timeout - use default
- profile_up "$DEFAULT" # JP: use profile_up and catch $?
- ret=$?
- if [[ $ret -eq 0 ]]; then echo "$DEFAULT" > "$STATE_DIR/menu"; fi
- ;;
- 0) # User selection
- profile_up "$(cat "$ANSWER")"
- ret=$?
- if [[ $ret -eq 0 ]]; then mv "$ANSWER" "$STATE_DIR/menu"; fi
- ;;
- *) # Shouldnt happen
- 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: