Wifi setup during install
This commit is contained in:
parent
395d6928e7
commit
e4fcb38372
|
@ -1712,6 +1712,35 @@ function add_onion_service {
|
|||
echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
|
||||
}
|
||||
|
||||
function setup_wifi {
|
||||
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
||||
return
|
||||
fi
|
||||
if [ ! $WIFI_SSID ]; then
|
||||
return
|
||||
fi
|
||||
if [ ${#WIFI_SSID} -lt 2 ]; then
|
||||
return
|
||||
fi
|
||||
if grep -Fxq "setup_wifi" $COMPLETION_FILE; then
|
||||
return
|
||||
fi
|
||||
if [[ $WIFI_TYPE != 'none' ]]; then
|
||||
if [ ! $WIFI_PASSPHRASE ]; then
|
||||
echo $'No wifi passphrase was given'
|
||||
return
|
||||
fi
|
||||
if [ ${#WIFI_PASSPHRASE} -lt 2 ]; then
|
||||
echo $'Wifi passphrase was too short'
|
||||
return
|
||||
fi
|
||||
${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE -p $WIFI_PASSPHRASE
|
||||
else
|
||||
${PROJECT_NAME}-wifi -i $WIFI_INTERFACE -s $WIFI_SSID -t $WIFI_TYPE
|
||||
fi
|
||||
echo 'setup_wifi' >> $COMPLETION_FILE
|
||||
}
|
||||
|
||||
function create_avahi_onion_domains {
|
||||
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
||||
return
|
||||
|
@ -10395,6 +10424,7 @@ set_your_domain_name
|
|||
time_synchronisation
|
||||
configure_internet_protocol
|
||||
create_git_project
|
||||
setup_wifi
|
||||
configure_ssh
|
||||
configure_ssh_onion
|
||||
allow_ssh_to_onion_address
|
||||
|
|
|
@ -1321,6 +1321,30 @@ function interactive_configuration {
|
|||
NAMESERVER2='213.73.91.35'
|
||||
fi
|
||||
|
||||
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
|
||||
data=$(tempfile 2>/dev/null)
|
||||
trap "rm -f $data" 0 1 2 5 15
|
||||
dialog --backtitle $"Freedombone Configuration" \
|
||||
--title $"Wifi setup" \
|
||||
--form $"\nIf you wish to use wifi rather than wired ethernet then enter the details below, otherwise just select Ok:" 15 55 5 \
|
||||
$"Interface:" 1 1 "$WIFI_INTERFACE" 1 16 16 15 \
|
||||
$"SSID:" 2 1 "$WIFI_SSID" 2 16 30 30 \
|
||||
$"Type:" 3 1 "$WIFI_TYPE" 3 16 16 15 \
|
||||
$"Passphrase:" 4 1 "$WIFI_PASSPHRASE" 4 16 30 30 \
|
||||
2> $data
|
||||
sel=$?
|
||||
case $sel in
|
||||
1) exit 1;;
|
||||
255) exit 1;;
|
||||
esac
|
||||
WIFI_INTERFACE=$(cat $data | sed -n 1p)
|
||||
WIFI_SSID=$(cat $data | sed -n 2p)
|
||||
WIFI_TYPE=$(cat $data | sed -n 3p)
|
||||
WIFI_PASSPHRASE=$(cat $data | sed -n 4p)
|
||||
save_configuration_file
|
||||
fi
|
||||
|
||||
|
||||
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" && $ONION_ONLY == "no" ]]; then
|
||||
|
||||
data=$(tempfile 2>/dev/null)
|
||||
|
|
|
@ -36,7 +36,7 @@ export TEXTDOMAINDIR="/usr/share/locale"
|
|||
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
|
||||
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
|
||||
|
||||
WIFI_DEVICE=wlan0
|
||||
WIFI_INTERFACE=wlan0
|
||||
WIFI_TYPE='wpa2-psk'
|
||||
WIFI_SSID=
|
||||
WIFI_PASSPHRASE=
|
||||
|
@ -53,27 +53,27 @@ function wifi_wpa2_psk {
|
|||
ssid=$1
|
||||
passphrase=$2
|
||||
psk=$(wifi_get_psk "$ssid" "$passphrase")
|
||||
echo "auto $WIFI_DEVICE" > /etc/network/interfaces.d/wifi
|
||||
echo 'iface $WIFI_DEVICE inet dhcp' >> /etc/network/interfaces.d/wifi
|
||||
echo "auto $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi
|
||||
echo 'iface $WIFI_INTERFACE inet dhcp' >> /etc/network/interfaces.d/wifi
|
||||
echo " wpa-ssid $ssid" >> /etc/network/interfaces.d/wifi
|
||||
echo " wpa-psk $psk" >> /etc/network/interfaces.d/wifi
|
||||
}
|
||||
|
||||
function wifi_none {
|
||||
ssid=$1
|
||||
echo "auto $WIFI_DEVICE" > /etc/network/interfaces.d/wifi
|
||||
echo 'iface $WIFI_DEVICE inet dhcp' >> /etc/network/interfaces.d/wifi
|
||||
echo "auto $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi
|
||||
echo 'iface $WIFI_INTERFACE inet dhcp' >> /etc/network/interfaces.d/wifi
|
||||
echo " wireless-essid $ssid" >> /etc/network/interfaces.d/wifi
|
||||
}
|
||||
|
||||
function show_help {
|
||||
echo ''
|
||||
echo $"${PROJECT_NAME}-wifi -d [device] -t [type] -s [ssid] -p [passphrase]"
|
||||
echo $"${PROJECT_NAME}-wifi -i [interface] -t [type] -s [ssid] -p [passphrase]"
|
||||
echo ''
|
||||
echo $'Wifi configuration tool'
|
||||
echo ''
|
||||
echo $' --help Show help'
|
||||
echo $' -d --device [name] Device name'
|
||||
echo $' -i --interface [wlan0|wlan1...] Device name'
|
||||
echo $' -t --type [wpa2-psk|none] Security type'
|
||||
echo $' -s --ssid [id] Set SSID'
|
||||
echo $' -p --passphrase [text] Set passphrase'
|
||||
|
@ -89,9 +89,9 @@ do
|
|||
--help)
|
||||
show_help
|
||||
;;
|
||||
-d|--device)
|
||||
-i|--if|--interface)
|
||||
shift
|
||||
WIFI_DEVICE=${1}
|
||||
WIFI_INTERFACE=${1}
|
||||
;;
|
||||
-t|--type)
|
||||
shift
|
||||
|
|
Loading…
Reference in New Issue