Skip to content

Commit

Permalink
fix installing hotspot when no inet
Browse files Browse the repository at this point in the history
Signed-off-by: Markus Storm <markus.storm@gmx.net>
  • Loading branch information
mstormi committed Apr 7, 2024
1 parent f333699 commit 5714aa4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions build-image/first-boot.bash
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ if ! running_in_docker && tryUntil "ping -c1 8.8.8.8 &> /dev/null || curl --sile
echo "FAILED"

if [[ "$hotSpot" == "enable" ]] && ! [[ -x $(command -v comitup) ]]; then
echo -n "$(timestamp) [openHABian] Installing comitup hotspot... "
if setup_hotspot "install"; then echo "OK"; else echo "FAILED"; fi
setup_hotspot
tryUntil "ping -c1 8.8.8.8 &> /dev/null || curl --silent --head http://www.openhab.org/docs |& grep -qs 'HTTP/1.1 200 OK'" 3 30
systemctl restart comitup
echo "OK"
Expand Down
12 changes: 9 additions & 3 deletions functions/wifi.bash
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ setup_hotspot() {
DEBIAN_FRONTEND=noninteractive apt install --yes network-manager &> /dev/null
systemctl enable --now NetworkManager

if ! cond_redirect wget -nv "https://davesteele.github.io/comitup/latest/$debfile"; then echo "FAILED (download hotspot repo info)"; return 1; fi
if ! dpkg -i --force-all "$debfile"; then echo "FAILED (install comitup repo info)"; return 1; fi
if ! cond_redirect apt-get --quiet update; then echo "FAILED (update comitup apt lists)"; return 1; fi
if cond_redirect wget -nv "https://davesteele.github.io/comitup/latest/$debfile"; then
cond_redirect dpkg -i --force-all "$debfile"
cond_redirect apt-get --quiet update
fi
rm -f "$debfile"

if ! cp "${BASEDIR:-/opt/openhabian}"/includes/comitup.conf /etc/comitup.conf; then echo "FAILED (comitup config)"; return 1; fi
Expand All @@ -143,6 +144,11 @@ setup_hotspot() {
echo "denyinterfaces wlan0 eth0" >> /etc/dhcpcd.conf
sed -i '3 i dhcp=internal' /etc/NetworkManager/NetworkManager.conf
install -m 644 "${BASEDIR:-/opt/openhabian}/includes/generic/100-disable-wifi-mac-randomization.conf" /etc/NetworkManager/conf.d/
if [[ $(systemctl is-active comitup) == "active" ]]; then
echo "OK"; return 0
else
echo "FAILED (comitup service not running)"; return 1
fi
elif [[ $1 == "disable" ]]; then
echo -n "$(timestamp) [openHABian] Uninstalling hotspot... "
if cond_redirect apt purge --yes comitup; then echo "OK"; else echo "FAILED"; return 1; fi
Expand Down

0 comments on commit 5714aa4

Please sign in to comment.