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

Fixing hostapd autodetedtion and small fixes

parent d43f68b2
# Armbian config
# Armbian configuration utility
Utility for configuring your board and install various services.
It comes with Armbian (from 5.27) by default. Login as super user and type:
Utility for configuring your board, adjust services and install applications. It comes with Armbian by default. Login and type:
armbian-config
......
......@@ -147,6 +147,18 @@ function jobs ()
nmtui-connect
;;
# Connect to wireless access point
#
"Clear" )
# remove managed interfaces
systemctl daemon-reload
rm /etc/NetworkManager/conf.d/armbian.conf
rm -f /etc/network/interfaces.d/armbian.ap.nat
rm -f /etc/network/interfaces.d/armbian.ap.bridge
reload-nety
;;
# Create WiFi access point
#
"Hotspot" )
......@@ -206,29 +218,37 @@ 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 restart;service hostapd status|grep running)
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
# check n,a and ac modes
if [[ -n "$CHECK" ]]; then
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 restart;service hostapd status|grep running)
if [[ -n "$CHECK" ]]; then
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;service hostapd status|grep fail)
if [[ -z "$CHECK" ]]; then
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 restart;service hostapd status|grep running)
if [[ -n "$CHECK" ]]; then
dialog --title " Info " --backtitle "$BACKTITLE" --no-collapse --colors --infobox "\nProbing wireless 802.11ac \Z1(433Mbps x n @ 5Ghz)\Z0" 5 51
sed '/### IEEE 802.11a\>/,/^### IEEE 802.11a\>/ s/^# *//' -i /etc/hostapd.conf
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;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
sed '/## IEEE 802.11a/,/^## IEEE 802.11a/ s/.*/#&/' -i /etc/hostapd.conf
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=$(systemctl daemon-reload;service hostapd restart;service hostapd status|grep fail)
CHECK=$(systemctl daemon-reload;service hostapd stop; sleep 2;service hostapd start;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
......@@ -241,12 +261,14 @@ 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 restart;service hostapd status|grep fail)
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
dialog --backtitle "$BACKTITLE" --title "Warning" \
--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
systemctl daemon-reload;service hostapd restart
sleep 3
break
......@@ -279,12 +301,9 @@ function jobs ()
# NAT
0)
TEMP_CONF="/etc/network/interfaces.d/armbian.ap.nat"
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' dnsmasq 2>/dev/null) != *ii* ]]; then
debconf-apt-progress -- apt-get -qq -y --no-install-recommends install dnsmasq
fi
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' iptables 2>/dev/null) != *ii* ]]; then
debconf-apt-progress -- apt-get -qq -y --no-install-recommends install iptables
fi
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' dnsmasq 2>/dev/null) != *ii* ]]; then debconf-apt-progress -- apt-get -qq -y --no-install-recommends install dnsmasq; fi
if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' iptables 2>/dev/null) != *ii* ]]; then debconf-apt-progress -- apt-get -qq -y --no-install-recommends install iptables; fi
echo -e "# armbian NAT hostapd\nallow-hotplug $WIRELESS_ADAPTER\niface $WIRELESS_ADAPTER inet static " > $TEMP_CONF
echo -e "\taddress 172.24.1.1\n\tnetmask 255.255.255.0\n\tnetwork 172.24.1.0\n\tbroadcast 172.24.1.255" >> $TEMP_CONF
# create new configuration
......
......@@ -59,6 +59,7 @@ function create_if_config() {
} #
function reload-nety() {
systemctl daemon-reload
if [[ "$1" == "reload" ]]; then WHATODO="Reloading services"; else WHATODO="Stopping services"; fi
(service network-manager stop; echo 10; sleep 1;\
service hostapd stop; echo 20; sleep 1;\
......@@ -423,7 +424,12 @@ while true; do
[[ -n $(nmcli device status | grep wifi | grep -w disconnected) ]] && LIST+=( "Hotspot" "Create WiFi access point" )
fi
[[ -n $(nmcli device status | grep wifi | grep -v unavailable | grep -v unmanaged) ]] && LIST+=( "WiFi" "Manage wireless networking" )
if [[ -n $(nmcli device status | grep wifi | grep -v unavailable | grep -v unmanaged) ]]; then
LIST+=( "WiFi" "Manage wireless networking" )
else
LIST+=( "Clear" "Clear possible blocked interfaces" )
fi
if [[ -n $(service bluetooth status | grep -w active | grep -w running) ]]; then
[[ $(hcitool dev | sed '1d') != "" ]] && LIST+=( "Bluetooth" "Connect Bluetooth devices" )
......
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