Wifi setup during install
This commit is contained in:
parent
395d6928e7
commit
e4fcb38372
136
src/freedombone
136
src/freedombone
|
@ -1712,6 +1712,35 @@ function add_onion_service {
|
||||||
echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
|
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 {
|
function create_avahi_onion_domains {
|
||||||
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
|
||||||
return
|
return
|
||||||
|
@ -6589,11 +6618,11 @@ function install_tox_client {
|
||||||
exit 67248
|
exit 67248
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# initial setup of username
|
# initial setup of username
|
||||||
#su -c "echo 'n
|
#su -c "echo 'n
|
||||||
#/nick $MY_USERNAME
|
#/nick $MY_USERNAME
|
||||||
#/exit
|
#/exit
|
||||||
#' | $TOXIC_FILE -d" - $MY_USERNAME
|
#' | $TOXIC_FILE -d" - $MY_USERNAME
|
||||||
|
|
||||||
echo 'install_tox_client' >> $COMPLETION_FILE
|
echo 'install_tox_client' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
@ -6876,57 +6905,57 @@ function install_irc_client {
|
||||||
echo ' },' >> /home/$MY_USERNAME/.irssi/config
|
echo ' },' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
echo ' {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo " address = \"127.0.0.1\";" >> /home/$MY_USERNAME/.irssi/config
|
echo " address = \"127.0.0.1\";" >> /home/$MY_USERNAME/.irssi/config
|
||||||
if [[ $ONION_ONLY == 'no' ]]; then
|
if [[ $ONION_ONLY == 'no' ]]; then
|
||||||
echo " port = \"${IRC_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
|
echo " port = \"${IRC_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' use_ssl = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' use_ssl = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
else
|
else
|
||||||
IRC_ONION_HOSTNAME=$(cat $COMPLETION_FILE | grep "IRC onion domain" | awk -F ':' '{print $2}')
|
IRC_ONION_HOSTNAME=$(cat $COMPLETION_FILE | grep "IRC onion domain" | awk -F ':' '{print $2}')
|
||||||
echo " port = \"${IRC_ONION_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
|
echo " port = \"${IRC_ONION_PORT}\";" >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' use_ssl = "no";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' use_ssl = "no";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
fi
|
fi
|
||||||
echo ' chatnet = "Freedombone";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' chatnet = "Freedombone";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' ssl_verify = "no";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' ssl_verify = "no";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' autoconnect = "yes";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
if [ $IRC_PASSWORD ]; then
|
if [ $IRC_PASSWORD ]; then
|
||||||
echo " password = \"${IRC_PASSWORD}\";" >> /home/$MY_USERNAME/.irssi/config
|
echo " password = \"${IRC_PASSWORD}\";" >> /home/$MY_USERNAME/.irssi/config
|
||||||
fi
|
fi
|
||||||
echo ' }' >> /home/$MY_USERNAME/.irssi/config
|
echo ' }' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo '' >> /home/$MY_USERNAME/.irssi/config
|
echo '' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo 'chatnets = {' >> /home/$MY_USERNAME/.irssi/config
|
echo 'chatnets = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' Freedombone = {' >> /home/$MY_USERNAME/.irssi/config
|
echo ' Freedombone = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' Freenode = {' >> /home/$MY_USERNAME/.irssi/config
|
echo ' Freenode = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_msgs = "4";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' OFTC = {' >> /home/$MY_USERNAME/.irssi/config
|
echo ' OFTC = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' type = "IRC";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_kicks = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_msgs = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_msgs = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
echo ' max_whois = "1";' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
echo ' };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo '' >> /home/$MY_USERNAME/.irssi/config
|
echo '' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo 'channels = (' >> /home/$MY_USERNAME/.irssi/config
|
echo 'channels = (' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/$MY_USERNAME/.irssi/config
|
echo ' { name = "#freedombone"; chatnet = "Freedombone"; autojoin = "Yes"; },' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
echo ');' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo '' >> /home/$MY_USERNAME/.irssi/config
|
echo '' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo 'settings = {' >> /home/$MY_USERNAME/.irssi/config
|
echo 'settings = {' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/$MY_USERNAME/.irssi/config
|
echo " core = { real_name = \"$MY_NAME\"; user_name = \"$MY_USERNAME\"; nick = \"$MY_USERNAME\"; };" >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/$MY_USERNAME/.irssi/config
|
echo ' "fe-text" = { actlist_sort = "refnum"; };' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
echo '};' >> /home/$MY_USERNAME/.irssi/config
|
||||||
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$MY_USERNAME/.irssi/config
|
echo 'ignores = ( { level = "CTCPS"; } );' >> /home/$MY_USERNAME/.irssi/config
|
||||||
|
|
||||||
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.irssi
|
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.irssi
|
||||||
|
|
||||||
echo 'install_irc_client' >> $COMPLETION_FILE
|
echo 'install_irc_client' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_irc_server {
|
function install_irc_server {
|
||||||
|
@ -10395,6 +10424,7 @@ set_your_domain_name
|
||||||
time_synchronisation
|
time_synchronisation
|
||||||
configure_internet_protocol
|
configure_internet_protocol
|
||||||
create_git_project
|
create_git_project
|
||||||
|
setup_wifi
|
||||||
configure_ssh
|
configure_ssh
|
||||||
configure_ssh_onion
|
configure_ssh_onion
|
||||||
allow_ssh_to_onion_address
|
allow_ssh_to_onion_address
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,7 +36,7 @@ export TEXTDOMAINDIR="/usr/share/locale"
|
||||||
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
|
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
|
||||||
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
|
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
|
||||||
|
|
||||||
WIFI_DEVICE=wlan0
|
WIFI_INTERFACE=wlan0
|
||||||
WIFI_TYPE='wpa2-psk'
|
WIFI_TYPE='wpa2-psk'
|
||||||
WIFI_SSID=
|
WIFI_SSID=
|
||||||
WIFI_PASSPHRASE=
|
WIFI_PASSPHRASE=
|
||||||
|
@ -53,30 +53,30 @@ function wifi_wpa2_psk {
|
||||||
ssid=$1
|
ssid=$1
|
||||||
passphrase=$2
|
passphrase=$2
|
||||||
psk=$(wifi_get_psk "$ssid" "$passphrase")
|
psk=$(wifi_get_psk "$ssid" "$passphrase")
|
||||||
echo "auto $WIFI_DEVICE" > /etc/network/interfaces.d/wifi
|
echo "auto $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi
|
||||||
echo 'iface $WIFI_DEVICE inet dhcp' >> /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-ssid $ssid" >> /etc/network/interfaces.d/wifi
|
||||||
echo " wpa-psk $psk" >> /etc/network/interfaces.d/wifi
|
echo " wpa-psk $psk" >> /etc/network/interfaces.d/wifi
|
||||||
}
|
}
|
||||||
|
|
||||||
function wifi_none {
|
function wifi_none {
|
||||||
ssid=$1
|
ssid=$1
|
||||||
echo "auto $WIFI_DEVICE" > /etc/network/interfaces.d/wifi
|
echo "auto $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi
|
||||||
echo 'iface $WIFI_DEVICE inet dhcp' >> /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
|
echo " wireless-essid $ssid" >> /etc/network/interfaces.d/wifi
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_help {
|
function show_help {
|
||||||
echo ''
|
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 ''
|
||||||
echo $'Wifi configuration tool'
|
echo $'Wifi configuration tool'
|
||||||
echo ''
|
echo ''
|
||||||
echo $' --help Show help'
|
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 $' -t --type [wpa2-psk|none] Security type'
|
||||||
echo $' -s --ssid [id] Set SSID'
|
echo $' -s --ssid [id] Set SSID'
|
||||||
echo $' -p --passphrase [text] Set passphrase'
|
echo $' -p --passphrase [text] Set passphrase'
|
||||||
echo ''
|
echo ''
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,9 @@ do
|
||||||
--help)
|
--help)
|
||||||
show_help
|
show_help
|
||||||
;;
|
;;
|
||||||
-d|--device)
|
-i|--if|--interface)
|
||||||
shift
|
shift
|
||||||
WIFI_DEVICE=${1}
|
WIFI_INTERFACE=${1}
|
||||||
;;
|
;;
|
||||||
-t|--type)
|
-t|--type)
|
||||||
shift
|
shift
|
||||||
|
|
Loading…
Reference in New Issue