Version 0.3

suites/experimental
KatolaZ 8 years ago
parent 6c412a8782
commit 33a4c4b01b
  1. 10
      ChangeLog
  2. 9
      setnet.8
  3. BIN
      setnet.8.gz
  4. 98
      setnet.sh

@ -1,3 +1,13 @@
2017-01-29 KatolaZ <katolaz@freaknet.org>
* setnet.sh:
* removed "Load file" and "New File" in WiFi configuration
2017-01-23 KatolaZ <katolaz@freaknet.org>
* setnet.sh:
* fixed a few minors bugs
2017-01-20 KatolaZ <katolaz@freaknet.org> 2017-01-20 KatolaZ <katolaz@freaknet.org>
* setnet.sh (0.3): * setnet.sh (0.3):

@ -8,6 +8,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm setnet.sh .Nm setnet.sh
.Op Fl c Ar config_file .Op Fl c Ar config_file
.Op Fl d Ar trace_file
.Op Fl h .Op Fl h
.Op Fl v .Op Fl v
.Sh DESCRIPTION .Sh DESCRIPTION
@ -20,10 +21,8 @@ including ip(8), dhclient(8), and wpa_cli(8).
.Pp .Pp
setnet.sh allows to configure static and/or DHCP-based connections to setnet.sh allows to configure static and/or DHCP-based connections to
a LAN/WLAN, and to manage the authentication to a Wi-Fi network. At a LAN/WLAN, and to manage the authentication to a Wi-Fi network. At
present, only open authentication (no key) and WPA-Personal present, open (no key), WPA-Personal (WPA-PSK and WPA2-PSK), and
authentication (WPA-PSK/WPA2-PSK) are supported. The support for basic WPA-Enterprise (EAP/PEAP or EAP/TLS) are supported.
WPA-Enterprise authentication (WPA-EAP-PEAP and WPA-EAP-TLS) is under
development.
.Pp .Pp
setnet.sh can be also used as a minimal interface to basic network setnet.sh can be also used as a minimal interface to basic network
@ -40,6 +39,8 @@ setnet.sh recognises the following options:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl c Ar config_file .It Fl c Ar config_file
specify a configuration file specify a configuration file
.It Fl d Ar trace_file
enable dialog debug, and write the trace to the provided trace_file
.It Fl h .It Fl h
print a minimal help and exit print a minimal help and exit
.It Fl v .It Fl v

Binary file not shown.

@ -292,8 +292,24 @@ check_deps(){
} }
##
## Set debug mode -- dialog is instructed to dump a trace to the file
## TRACE_FILE provided by the user
## ##
## Generic function fo unimplemented features. It just pops up a
##function
set_debug(){
TRACE_FILE=$1
DEBUG_MODE="DEBUG"
DIALOG="${DIALOG} --trace ${TRACE_FILE}"
}
##
## Generic function for unimplemented features. It just pops up a
## message-box and returns ## message-box and returns
## ##
@ -1218,60 +1234,6 @@ wifi_disable(){
##function
wifi_load_file(){
##local
DEVNAME=$1
MSG="You are running setnet through sudo or sup!!!\nLoad file is
disabled!" check_sudo "${MSG}"
if [ $? -eq 1 ]; then
return
fi
eval "${DIALOG} --fselect ${WPA_FILE} ${WINDOW_HEIGHT} ${WINDOW_WIDTH}" \
2>${TMPFILE}
if [ $? -eq 0 ]; then
SEL_FILE=$(cat ${TMPFILE})
while [ -d "${SEL_FILE}" ]; do
eval "${DIALOG} --fselect ${SEL_FILE} ${WINDOW_HEIGHT} ${WINDOW_WIDTH}" \
2>${TMPFILE}
if [ $? -eq 0 ]; then
SEL_FILE=$(cat ${TMPFILE})
else
eval "${DIALOG} --msgbox 'WPA_FILE was not modified' \
${INFO_HEIGHT} ${INFO_WIDTH}"
return
fi
done
if [ -f "${SEL_FILE}" ]; then
WPA_FILE=${SEL_FILE}
eval "${DIALOG} --defaultno --yesno \
'WPA_FILE changed to ${WPA_FILE}\nRestart wpa_supplicant?' \
${INFO_HEIGHT} ${INFO_WIDTH}"
if [ $? -eq 0 ]; then
wifi_restart_wpa ${DEVNAME} ${WPA_FILE}
fi
else
eval "${DIALOG} --msgbox 'Invalid file name!\n WPA_FILE *not* changed' \
${WINDOW_HEIGHT} ${WINDOW_WIDTH}"
return
fi
else
eval "${DIALOG} --msgbox 'WPA_FILE was not modified' \
${INFO_HEIGHT} ${INFO_WIDTH}"
fi
}
##function ##function
config_wifi(){ config_wifi(){
@ -1281,7 +1243,7 @@ config_wifi(){
while true; do while true; do
CUR_NET=$(wpa_cli -i ${DEVNAME} status | grep "^ssid" | cut -d "=" -f 2) CUR_NET=$(wpa_cli -i ${DEVNAME} status | grep "^ssid" | cut -d "=" -f 2)
eval "${DIALOG} --cancel-label 'Up' \ eval "${DIALOG} --cancel-label 'Up' \
--menu 'Configuring ${DEVNAME}\tCurrent network: ${CUR_NET}\n(Current file: ${WPA_FILE})' \ --menu 'Configuring ${DEVNAME}\nCurrent network: ${CUR_NET}\n(Current file: ${WPA_FILE})' \
${WINDOW_HEIGHT} ${WINDOW_WIDTH} 12 \ ${WINDOW_HEIGHT} ${WINDOW_WIDTH} 12 \
'Restart' 'Restart wpa_supplicant' \ 'Restart' 'Restart wpa_supplicant' \
'Enable' 'Enable a configured network' \ 'Enable' 'Enable a configured network' \
@ -1290,9 +1252,7 @@ config_wifi(){
'Remove' 'Delete an existing network' \ 'Remove' 'Delete an existing network' \
'Show' 'Show current configuration file' \ 'Show' 'Show current configuration file' \
'Edit' 'Edit current configuration file' \ 'Edit' 'Edit current configuration file' \
'Save' 'Save configuration to file'\ 'Save' 'Save configuration to file' "\
'Load' 'Load configuration from file'\
'New' 'Create new configuration file' " \
2>${TMPFILE} 2>${TMPFILE}
if [ $? = "1" ]; then if [ $? = "1" ]; then
@ -1326,12 +1286,6 @@ config_wifi(){
"Save") "Save")
wifi_save_file ${DEVNAME} wifi_save_file ${DEVNAME}
;; ;;
"Load")
wifi_load_file ${DEVNAME}
;;
"New")
unimplemented "New"
;;
esac esac
done done
@ -2099,7 +2053,13 @@ initialise(){
chmod 600 ${LOGFILE} chmod 600 ${LOGFILE}
log "setnet" "Starting afresh on $(date)" log "initialise" "Starting afresh on $(date)"
log "initialise" "Using TMPFILE: ${TMPFILE}"
log "initialise" "Using LOGFILE: ${LOGFILE}"
if [ -n ${DEBUG_MODE} ]; then
log "initialise" "Running in debug mode -- dumping dialog trace to ${TRACE_FILE}"
fi
EUID=$(id -ru) EUID=$(id -ru)
if [ "${EUID}" = "0" ] && if [ "${EUID}" = "0" ] &&
@ -2186,7 +2146,7 @@ main(){
SETNETRC="" SETNETRC=""
while getopts ":c:hv" opt; do while getopts ":c:d:hv" opt; do
case $opt in case $opt in
c) c)
@ -2202,6 +2162,10 @@ while getopts ":c:hv" opt; do
show_version $(basename $0) show_version $(basename $0)
exit 1 exit 1
;; ;;
d)
TRACE_FILE=$(realpath ${OPTARG})
set_debug ${TRACE_FILE}
;;
\?) \?)
echo "Invalid option: -${OPTARG}" echo "Invalid option: -${OPTARG}"
exit 1 exit 1

Loading…
Cancel
Save