diff --git a/docs/Makefile b/docs/Makefile index 4da4a11..79a62b8 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,6 +1,6 @@ # Makefile for netctl documentation -MANPAGES = netctl.1 netctl-auto.1 netctl.profile.5 netctl.special.7 +MANPAGES = netctl.1 netctl-auto.1 netctl.profile.5 netctl.special.7 wifi-menu.8 .PHONY: manpages install $(MANPAGES:=-install) clean diff --git a/docs/wifi-menu.8.txt b/docs/wifi-menu.8.txt new file mode 100644 index 0000000..937010a --- /dev/null +++ b/docs/wifi-menu.8.txt @@ -0,0 +1,89 @@ +WIFI-MENU(8) +============ + +NAME +---- +wifi-menu - Interactively connect to a wireless network + + +SYNOPSIS +-------- +*wifi-menu* [-o | --obscure] [+INTERFACE+] + +*wifi-menu* [-h | --help] + + +DESCRIPTION +----------- +*wifi-menu* allows a user to interactively connect to a wireless network +over INTERFACE using an existing netctl profile, or an automatically +generated profile for basic configurations. If only one wireless +interface is available, INTERFACE can be omitted. If no interface is +specified and more than one is detected, a choice of interfaces is +offered. + +*wifi-menu* is only able to generate netctl profiles for simple network +configurations. Profiles for more complex configurations must be set up +manually, or through the use of other tools. + +OPTIONS +------- + +*-h, --help*:: + Print a short help text and exit. + +*-o, --obscure*:: + Do not echo password, and store derived pre-shared key + in profile instead of plaintext password. + ++INTERFACE+:: + The wireless network interface to use for connecting. + + +EXIT STATUS +----------- + +*0*:: + The interface connected to the wireless network successfully. + +*1*:: + The connection attempt was cancelled. + +*2*:: + The connection attempt failed. + +*3*:: + No wireless networks were found. + +*4*:: + Invalid passphrase length (WEP keys must be between 8 and 63 characters + in length). + +*7*:: + An unexpected error code was received. + +*255*:: + The connection attempt was aborted (or an error occurred). + + +NOTES +----- +The program may display a black screen for up to a minute when starting a +connection. + + +ENVIRONMENT +----------- ++$NETCTL_DEBUG+:: + If set to +"yes"+, debugging output is generated. + + +FILES +----- ++/etc/netctl+:: + Directory where created netctl profiles are stored. + + +SEE ALSO +-------- +*netctl*(1), *netctl-auto*(1) diff --git a/src/wifi-menu b/src/wifi-menu index f2030ae..8dc8532 100755 --- a/src/wifi-menu +++ b/src/wifi-menu @@ -15,8 +15,8 @@ If only one wireless interface is available, INTERFACE can be omitted. Arguments: -h, --help Show this help - -o, --obscure Show asterisks for the characters of the password - and store the password as a hexadecimal string + -o, --obscure Do not echo password, and store derived pre-shared + key in profile instead of plaintext password. END } @@ -242,13 +242,19 @@ cd / # We do not want to spawn anything that can block unmounting INTERFACE=$1 if [[ -z "$INTERFACE" ]]; then - INTERFACE=(/sys/class/net/*/wireless/) - if [[ ${#INTERFACE[@]} -ne 1 || ! -d "$INTERFACE" ]]; then - report_error "Invalid interface specification" + INTERFACES=(/sys/class/net/*/wireless/) + if [[ ${#INTERFACES[@]} -gt 1 ]]; then + INTERFACES=$(for INTERFACE in ${INTERFACES[@]}; do + echo ${INTERFACE:15:-10} + done) + INTERFACE=$(dialog --no-items --menu "Select the interface you wish to use" 24 50 12 $INTERFACES --stdout) + elif [[ -d "$INTERFACES" ]]; then + INTERFACE=${INTERFACES:15:-10} + else + report_error "No wireless interfaces found" usage exit 255 fi - INTERFACE=${INTERFACE:15:-10} report_debug "Using interface '$INTERFACE'" elif ! is_interface "$INTERFACE"; then exit_error "No such interface: $INTERFACE"