Daemon to start wifi
This commit is contained in:
parent
626e9b66d5
commit
6dea0a87ff
|
@ -1384,13 +1384,16 @@ function wifi_settings {
|
|||
cp $TEMP_WIFI_NETWORKS_FILE $WIFI_NETWORKS_FILE
|
||||
rm $TEMP_WIFI_NETWORKS_FILE
|
||||
${PROJECT_NAME}-wifi --networks $WIFI_NETWORKS_FILE
|
||||
create_wifi_startup_script
|
||||
if [[ $(wifi_is_running) == "1" ]]; then
|
||||
dialog --title $"Wifi Settings" \
|
||||
--msgbox $"Wifi settings were changed." 6 60
|
||||
else
|
||||
dialog --title $"Wifi Settings" \
|
||||
--msgbox $"Wifi settings were changed. You will need to restart the system for the changes to take effect." 6 60
|
||||
--msgbox $"Wifi settings were changed. You will need to restart the system with ethernet cable removed for the changes to take effect." 7 60
|
||||
fi
|
||||
else
|
||||
remove_wifi_startup_script
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -409,7 +409,22 @@ EOF
|
|||
END_MESSAGE_HEIGHT=12
|
||||
fi
|
||||
echo " if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then" >> $rootdir/root/.bashrc
|
||||
echo " ${PROJECT_NAME}-wifi" >> $rootdir/root/.bashrc
|
||||
echo " echo '[Unit]' > /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'Description=WifiStartup (Start wifi networking)' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'After=syslog.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'After=network.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo '' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo '[Service]' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'Type=simple' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'User=root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'Group=root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'WorkingDirectory=/root' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'ExecStart=/usr/local/bin/freedombone-wifi' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo '' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo '[Install]' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " echo 'WantedBy=multi-user.target' >> /etc/systemd/system/wifistart.service" >> $rootdir/root/.bashrc
|
||||
echo " systemctl enable wifistart" >> $rootdir/root/.bashrc
|
||||
echo " systemctl daemon-reload" >> $rootdir/root/.bashrc
|
||||
echo ' fi' >> $rootdir/root/.bashrc
|
||||
echo " dialog --title '$END_MESSAGE1' --msgbox \"$END_MESSAGE2\" ${END_MESSAGE_HEIGHT} 60" >> $rootdir/root/.bashrc
|
||||
echo ' reboot' >> $rootdir/root/.bashrc
|
||||
|
|
|
@ -44,9 +44,9 @@ function install_final {
|
|||
echo ''
|
||||
|
||||
echo $"
|
||||
*** ${PROJECT_NAME} installation is complete. Rebooting... ***
|
||||
*** ${PROJECT_NAME} installation is complete ***
|
||||
|
||||
Ensure that these ports are forwarded from your internet router
|
||||
Ensure that ports are forwarded from your internet router
|
||||
"
|
||||
echo ''
|
||||
|
||||
|
@ -60,9 +60,10 @@ function install_final {
|
|||
fi
|
||||
if [ ! -f $IMAGE_PASSWORD_FILE ]; then
|
||||
if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then
|
||||
if [[ $(wifi_is_running) == "0" ]]; then
|
||||
${PROJECT_NAME}-wifi
|
||||
fi
|
||||
create_wifi_startup_script
|
||||
echo $'Shutting down the system. Detatch the ethernet cable, then power on again.'
|
||||
shutdown now
|
||||
return
|
||||
fi
|
||||
reboot
|
||||
fi
|
||||
|
|
|
@ -549,4 +549,34 @@ function count_wlan {
|
|||
echo $ctr
|
||||
}
|
||||
|
||||
function create_wifi_startup_script {
|
||||
systemd_file=/etc/systemd/system/wifistart.service
|
||||
echo '[Unit]' > $systemd_file
|
||||
echo 'Description=WifiStartup (Start wifi networking)' >> $systemd_file
|
||||
echo 'After=syslog.target' >> $systemd_file
|
||||
echo 'After=network.target' >> $systemd_file
|
||||
echo '' >> $systemd_file
|
||||
echo '[Service]' >> $systemd_file
|
||||
echo 'Type=simple' >> $systemd_file
|
||||
echo 'User=root' >> $systemd_file
|
||||
echo 'Group=root' >> $systemd_file
|
||||
echo 'WorkingDirectory=/root' >> $systemd_file
|
||||
echo "ExecStart=/usr/local/bin/${PROJECT_NAME}-wifi" >> $systemd_file
|
||||
echo '' >> $systemd_file
|
||||
echo '[Install]' >> $systemd_file
|
||||
echo 'WantedBy=multi-user.target' >> $systemd_file
|
||||
|
||||
systemctl enable wifistart
|
||||
systemctl daemon-reload
|
||||
}
|
||||
|
||||
function remove_wifi_startup_script {
|
||||
systemd_file=/etc/systemd/system/wifistart.service
|
||||
if [ -f $systemd_file ]; then
|
||||
systemctl disable wifistart
|
||||
systemctl daemon-reload
|
||||
rm $systemd_file
|
||||
fi
|
||||
}
|
||||
|
||||
# NOTE: deliberately no exit 0
|
||||
|
|
Loading…
Reference in New Issue