Skip to content

Commit

Permalink
hotspot: don't try to offer hotspot if there's no wifi device
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information
dirkhh committed May 27, 2024
1 parent 69d5869 commit 3c06cc1
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ fi
gateway=$(ip route | awk '/default/ { print $3 }')

if [[ $gateway == "" ]] || ! ping -c 1 -W 1 "$gateway" &> /dev/null ; then
# that's not good, let's start an access point
echo "No internet connection detected, starting access point"
systemctl unmask hostapd.service
systemctl unmask isc-dhcp-server.service
# that's not good, let's try to start an access point
wlan=$(iw dev | grep Interface | cut -d' ' -f2)
if [[ $wlan == "" ]] ; then
echo "No wireless interface detected, giving up"
exit 1
exit 1
fi
echo "No internet connection detected, starting access point"
systemctl unmask hostapd.service
systemctl unmask isc-dhcp-server.service
if [[ $wlan != "wlan0" ]] ; then
sed -i "s/wlan0/$wlan/g" /etc/default/isc-dhcp-server
sed -i "s/wlan0/$wlan/g" /etc/hostapd/hostapd.conf
Expand Down

0 comments on commit 3c06cc1

Please sign in to comment.