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.
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
......@@ -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
# Main loop
......@@ -262,8 +266,8 @@ while true; do
if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop" )
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Enable standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Enable simple auto login manager" )
[[ $DISPLAY_MANAGER == 'nodm' ]] && LIST+=( "Lightdm" "Switch to standard login manager" )
[[ $DISPLAY_MANAGER == 'lightdm' ]] && LIST+=( "Nodm" "Switch to simple auto login manager" )
else
LIST+=( "Desktop" "Enable desktop" )
fi
......@@ -432,7 +436,7 @@ while true; do
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
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
fi
;;
......@@ -518,14 +522,22 @@ while true; do
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
exitstatus=$?;
if [[ $exitstatus = 0 ]]; then service hostapd stop ; sed -i "s/^DAEMON_CONF=.*/DAEMON_CONF=/" /etc/init.d/hostapd; \
systemctl daemon-reload; fi
if [[ $exitstatus = 0 ]]; then
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
elif [[ -n $CURRENT_UUID ]]; then
dialog --title "Info" --backtitle "$BACKTITLE" --no-collapse \
--yesno "\nWireless connection is in use.\n\nDo you want to disconnect?" 9 57
[[ $? = 0 ]] && nmcli connection down uuid $CURRENT_UUID
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
wlan_exceptions "on"
# check for WLAN interfaces
......@@ -568,6 +580,9 @@ while true; do
response=$?
DEFAULT_ADAPTER=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
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"
cp $NETWORK_CONF $TEMP_CONF
......@@ -632,10 +647,16 @@ while true; do
esac
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"
response=$?
service hostapd stop
if [[ $? = 0 ]]; then
mv $TEMP_CONF $NETWORK_CONF
reboot
if [[ $response = 0 ]]; then
mv $TEMP_CONF /etc/network/interfaces
service networking restart
ifdown $DEFAULT_ADAPTER
ifup $DEFAULT_ADAPTER
service hostapd start
#reboot
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