Commit a0ad755f authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Check advanced modes moved to new function, fixed compatibility issues with...

Check advanced modes moved to new function, fixed compatibility issues with older versions of Network manager found in Jessie
parent 7d6470f5
......@@ -155,7 +155,7 @@ function jobs ()
"Clear" )
# remove managed interfaces
systemctl daemon-reload
rm /etc/NetworkManager/conf.d/armbian.conf
sed '/keyfile\|unmanaged-devices/ d' -i /etc/NetworkManager/NetworkManager.conf
rm -f /etc/network/interfaces.d/armbian.ap.nat
rm -f /etc/network/interfaces.d/armbian.ap.bridge
reload-nety
......@@ -181,7 +181,7 @@ function jobs ()
# disable DNS
systemctl daemon-reload
systemctl disable dnsmasq.service >/dev/null 2>&1
rm /etc/NetworkManager/conf.d/armbian.conf
ifdown $WIRELESS_ADAPTER 2> /dev/null
rm -f /etc/network/interfaces.d/armbian.ap.nat
rm -f /etc/network/interfaces.d/armbian.ap.bridge
......@@ -196,19 +196,18 @@ function jobs ()
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --msgbox "\nAll wireless connections are in use." 7 40
else
# remove interfaces from managed list
rm -f /etc/NetworkManager/conf.d/armbian.conf
service network-manager reload
sed '/keyfile\|unmanaged-devices/ d' -i /etc/NetworkManager/NetworkManager.conf
service network-manager restart; sleep 2
# change special adapters to AP mode
wlan_exceptions "on"
# check for WLAN interfaces
get_wlan_interface
# add interface to unmanaged list
echo "[keyfile]" > /etc/NetworkManager/conf.d/armbian.conf
echo "unmanaged-devices=interface-name:$WIRELESS_ADAPTER" >>/etc/NetworkManager/conf.d/armbian.conf
service network-manager reload
echo "[keyfile]" >> /etc/NetworkManager/NetworkManager.conf
echo "unmanaged-devices=interface-name:$WIRELESS_ADAPTER" >> /etc/NetworkManager/NetworkManager.conf
service network-manager restart; sleep 2
# display dialog
dialog --backtitle "$BACKTITLE" --title "Please wait" \
--infobox "\nWireless adapter: $WIRELESS_ADAPTER\n\nProbing nl80211 hostapd driver compatibility." 7 50
dialog --colors --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nWireless adapter: \Z1${WIRELESS_ADAPTER}\Z0\n\nProbing nl80211 hostapd driver compatibility." 7 50
apt-get -o Dpkg::Options::="--force-confnew" -y -qq --no-install-recommends install hostapd > /dev/null
# change to selected interface
sed -i "s/^interface=.*/interface=$WIRELESS_ADAPTER/" /etc/hostapd.conf
......@@ -221,43 +220,12 @@ function jobs ()
echo "ctrl_interface=/var/run/hostapd" >> /etc/hostapd.conf
echo "ctrl_interface_group=0" >> /etc/hostapd.conf
fi
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
# check n,a and ac modes
if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11n \Z1(150-300Mbps)\Z0" 5 43
sleep 2
sed '/### IEEE 802.11n/,/^### IEEE 802.11n/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then
# check various HT modes
check_ht_capab
# than go to check 5Ghz
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11a \Z1(5Ghz)\Z0" 5 36
sleep 2
sed '/### IEEE 802.11a\>/,/^### IEEE 802.11a\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0" 5 51
sleep 2
sed '/### IEEE 802.11ac\>/,/^### IEEE 802.11ac\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
if [[ -n "$CHECK" ]]; then
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0 is not supported!" 5 60
sed '/## IEEE 802.11ac\>/,/^## IEEE 802.11ac\>/ s/.*/#&/' -i /etc/hostapd.conf
fi
else
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11a \Z1(5Ghz)\Z0 is not supported!" 5 45
sed '/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/' -i /etc/hostapd.conf
fi
else
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11n \Z1(150-300Mbps)\Z0 is not supported!" 5 52
sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf
fi
fi
#
check_advanced_modes
#
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -n "$CHECK" ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" \
--infobox "\nWireless adapter: $WIRELESS_ADAPTER\n\nProbing Realtek hostapd driver compatibility." 7 50
dialog --colors --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nWireless adapter: \Z1${WIRELESS_ADAPTER}\Z0\n\nProbing Realtek hostapd driver compatibility." 7 50
apt-get -o Dpkg::Options::="--force-confnew" -y -qq --no-install-recommends install hostapd-realtek > /dev/null
# change to selected interface
sed -i "s/^interface=.*/interface=$WIRELESS_ADAPTER/" /etc/hostapd.conf
......@@ -267,6 +235,9 @@ function jobs ()
echo "ctrl_interface=/var/run/hostapd" >> /etc/hostapd.conf
echo "ctrl_interface_group=0" >> /etc/hostapd.conf
fi
#
check_advanced_modes
#
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
# if both fails there is other problem
if [[ -n "$CHECK" ]]; then
......@@ -274,7 +245,7 @@ function jobs ()
--infobox "\nWireless adapter: $WIRELESS_ADAPTER\n\nNo compatible hostapd driver found." 7 39
sed -i "s/^DAEMON_CONF=.*/DAEMON_CONF=/" /etc/init.d/hostapd
# remove interfaces from managed list
rm -f /etc/NetworkManager/conf.d/armbian.conf
sed '/keyfile\|unmanaged-devices/ d' -i /etc/NetworkManager/NetworkManager.conf
systemctl daemon-reload;service hostapd restart
sleep 3
break
......
......@@ -40,6 +40,44 @@ if [[ $? -ne 0 ]]; then
fi
function check_advanced_modes ()
{
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
# check n,a and ac modes
if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11n \Z1(150-300Mbps)\Z0" 5 43
sleep 2
sed '/### IEEE 802.11n/,/^### IEEE 802.11n/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then
# check various HT modes
check_ht_capab
# than go to check 5Ghz
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11a \Z1(5Ghz)\Z0" 5 36
sleep 2
sed '/### IEEE 802.11a\>/,/^### IEEE 802.11a\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;sleep 2;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0" 5 51
sleep 2
sed '/### IEEE 802.11ac\>/,/^### IEEE 802.11ac\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
if [[ -n "$CHECK" ]]; then
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0 is not supported!" 5 60
sed '/## IEEE 802.11ac\>/,/^## IEEE 802.11ac\>/ s/.*/#&/' -i /etc/hostapd.conf
fi
else
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11a \Z1(5Ghz)\Z0 is not supported!" 5 45
sed '/## IEEE 802.11a\>/,/^## IEEE 802.11a\>/ s/.*/#&/' -i /etc/hostapd.conf
fi
else
dialog --title " Reverting configuration " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nWireless 802.11n \Z1(150-300Mbps)\Z0 is not supported!" 5 52
sed '/## IEEE 802.11n/,/^## IEEE 802.11n/ s/.*/#&/' -i /etc/hostapd.conf
fi
fi
}
#-----------------------------------------------------------------------------------------------------------------------------------------#
#
# create interface configuration section
......
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