Commit 9ed9018f authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Bugfixes and showing dislaimer only when starting AP mode which is at most critical part

parent ee02d1ca
...@@ -46,6 +46,17 @@ BACKTITLE="$ARMBIAN $DISTRO $DISTROID configuration utility, http://www.armbian. ...@@ -46,6 +46,17 @@ BACKTITLE="$ARMBIAN $DISTRO $DISTROID configuration utility, http://www.armbian.
TITLE="Configuring $BOARD_NAME" TITLE="Configuring $BOARD_NAME"
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# show disclaimer
#
function beta_disclaimer ()
{
exec 3>&1
ACKNOWLEDGEMENT=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse --title "Warning" --clear \--radiolist "\n$1.\n \n" 12 56 7 "Yes, I understand" "" off 2>&1 1>&3)
exec 3>&-
}
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# #
# show description for MOTD files # show description for MOTD files
...@@ -227,13 +238,6 @@ function connect_bt_interface () ...@@ -227,13 +238,6 @@ function connect_bt_interface ()
# #
#-----------------------------------------------------------------------------------------------------------------------------------------# #-----------------------------------------------------------------------------------------------------------------------------------------#
# Show disclaimer where you need to press SPACE to continue. To make sure warning is read.
#
#exec 3>&1
#ACKNOWLEDGEMENT=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse --title "Warning" --clear \--radiolist "\nThis configuration tool runs under superuser rights.\n \n" 10 56 7 "Yes, I understand the risks" "" off 2>&1 1>&3)
#exec 3>&-
# if [[ $ACKNOWLEDGEMENT == "" ]]; then exit; fi
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45 dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nLoading Armbian configuration utility ... " 5 45
# Main loop # Main loop
...@@ -262,8 +266,8 @@ while true; do ...@@ -262,8 +266,8 @@ while true; do
if [[ -n $DISPLAY_MANAGER ]]; then if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop" ) LIST+=( "Desktop" "Disable desktop" )
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Enable standard login manager" ) [[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Enable simple auto login manager" ) [[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
else else
LIST+=( "Desktop" "Enable desktop" ) LIST+=( "Desktop" "Enable desktop" )
fi fi
...@@ -432,7 +436,7 @@ while true; do ...@@ -432,7 +436,7 @@ while true; do
dialog --title "Choose a display manager" --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Lightdm" \ dialog --title "Choose a display manager" --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Lightdm" \
--no-label "Nodm" --yesno "\nLightdm = full featured login display manager\nNodm = autoloading into desktop" 8 70 --no-label "Nodm" --yesno "\nLightdm = full featured login display manager\nNodm = autoloading into desktop" 8 70
exitstatus=$?; exitstatus=$?;
[[ $exitstatus = 0 ]] && systemctl start lightdm.service [[ $exitstatus = 0 ]] && apt-get -o Dpkg::Options::="--force-confold" -y -qq --no-install-recommends install lightdm-gtk-greeter lightdm >/dev/null 2>&1 && systemctl start lightdm.service
[[ $exitstatus = 1 ]] && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start [[ $exitstatus = 1 ]] && sed -i "s/^NODM_ENABLED=.*/NODM_ENABLED=true/" /etc/default/nodm && service nodm start
fi fi
;; ;;
...@@ -518,14 +522,22 @@ while true; do ...@@ -518,14 +522,22 @@ while true; do
dialog --title "Hostapd service is running" --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Stop" \ dialog --title "Hostapd service is running" --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Stop" \
--no-label "Edit" --yesno "\nStop: stop and disable\n\nEdit: change basic parameters: SSID, password and channel" 9 70 --no-label "Edit" --yesno "\nStop: stop and disable\n\nEdit: change basic parameters: SSID, password and channel" 9 70
exitstatus=$?; exitstatus=$?;
if [[ $exitstatus = 0 ]]; then service hostapd stop ; sed -i "s/^DAEMON_CONF=.*/DAEMON_CONF=/" /etc/init.d/hostapd; \ if [[ $exitstatus = 0 ]]; then
systemctl daemon-reload; fi service hostapd stop
sed -i "s/^DAEMON_CONF=.*/DAEMON_CONF=/" /etc/init.d/hostapd
systemctl daemon-reload
rm /etc/NetworkManager/conf.d/armbian.conf
service network-manager reload
fi
if [[ $exitstatus = 1 ]]; then wlan_edit; service hostapd stop; sleep 1; service hostapd start; fi if [[ $exitstatus = 1 ]]; then wlan_edit; service hostapd stop; sleep 1; service hostapd start; fi
elif [[ -n $CURRENT_UUID ]]; then elif [[ -n $CURRENT_UUID ]]; then
dialog --title "Info" --backtitle "$BACKTITLE" --no-collapse \ dialog --title "Info" --backtitle "$BACKTITLE" --no-collapse \
--yesno "\nWireless connection is in use.\n\nDo you want to disconnect?" 9 57 --yesno "\nWireless connection is in use.\n\nDo you want to disconnect?" 9 57
[[ $? = 0 ]] && nmcli connection down uuid $CURRENT_UUID [[ $? = 0 ]] && nmcli connection down uuid $CURRENT_UUID
else else
# check if user agree to enter this area
beta_disclaimer "Wireless networking in Linux is problematic. Our tools make it easy for some cases but can't enable AP on every random WiFi chip. If this tool fail, check manual methods."
if [[ -n $ACKNOWLEDGEMENT ]]; then
# change special adapters to AP mode # change special adapters to AP mode
wlan_exceptions "on" wlan_exceptions "on"
# check for WLAN interfaces # check for WLAN interfaces
...@@ -568,6 +580,9 @@ while true; do ...@@ -568,6 +580,9 @@ while true; do
response=$? response=$?
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)') DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
NETWORK_CONF="/etc/network/interfaces" NETWORK_CONF="/etc/network/interfaces"
dialog --title "Network configuration" --backtitle "$BACKTITLE" --yesno "\nStart with clean config?" 7 29
[[ $? = 0 ]] && NETWORK_CONF="/etc/network/interfaces.default";
TEMP_CONF="/etc/network/interfaces.out" TEMP_CONF="/etc/network/interfaces.out"
cp $NETWORK_CONF $TEMP_CONF cp $NETWORK_CONF $TEMP_CONF
...@@ -632,10 +647,16 @@ while true; do ...@@ -632,10 +647,16 @@ while true; do
esac esac
dialog --title "Manually adjust network configuration if needed" --backtitle "$BACKTITLE" \ dialog --title "Manually adjust network configuration if needed" --backtitle "$BACKTITLE" \
--ok-label "Reboot to apply new settings" --no-collapse --editbox $TEMP_CONF 30 0 2> $TEMP_CONF".tmp" --ok-label "Reboot to apply new settings" --no-collapse --editbox $TEMP_CONF 30 0 2> $TEMP_CONF".tmp"
response=$?
service hostapd stop service hostapd stop
if [[ $? = 0 ]]; then if [[ $response = 0 ]]; then
mv $TEMP_CONF $NETWORK_CONF mv $TEMP_CONF /etc/network/interfaces
reboot service networking restart
ifdown $DEFAULT_ADAPTER
ifup $DEFAULT_ADAPTER
service hostapd start
#reboot
fi
fi fi
fi fi
;; ;;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment