Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM balenalib/%%BALENA_ARCH%%-python as builder

RUN install_packages dnsmasq wireless-tools git rsync binutils busybox-static
RUN install_packages dnsmasq wireless-tools git rsync binutils busybox-static jq

WORKDIR /usr/src/app

RUN curl https://api.github.com/repos/balena-io/wifi-connect/releases/latest -s \
| grep -hoP 'browser_download_url": "\K.*%%BALENA_ARCH%%\.tar\.gz' \
RUN curl https://api.github.com/repos/balena-io/wifi-connect/releases/latest -Ls \
| jq -r '.assets | .[] | select(.browser_download_url|test("^.*%%BALENA_ARCH%%.*$")) | .browser_download_url' \
| xargs -n1 curl -Ls \
| tar -xvz -C /usr/src/app/

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ FROM balenablocks/wifi-connect:%%BALENA_ARCH%%
| `PORTAL_SSID` | WiFi Connect | SSID of the captive portal WiFi network |
| `ACTIVITY_TIMEOUT` | `0` - no timeout | Exit if no activity for the specified timeout (seconds) |
| `CHECK_CONN_FREQ` | `120` - specified number of seconds | The frequency with which to check if the device is connected to the internet. |
| `VERBOSE` | none | Set `false` to silence the logging messages |
| `VERBOSE` | none | Set `silent` to silence the logging messages |

You can refer to the [docs](https://www.balena.io/docs/learn/manage/serv-vars/#environment-and-service-variables) on how to set environment or service variables

Expand Down
7 changes: 5 additions & 2 deletions balena.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ assets:
repository:
type: blob.asset
data:
url: 'https://github.com/balenablocks/wifi-connect'
url: "https://github.com/balenablocks/wifi-connect"
logo:
type: blob.asset
data:
url: >-
https://raw.githubusercontent.com/balenablocks/wifi-connect/master/logo.png
data:
defaultDeviceType: raspberry-pi
defaultDeviceType: raspberrypi3
supportedDeviceTypes:
- raspberry-pi
- raspberry-pi2
- raspberrypi3
- raspberrypi3-64
- raspberrypi4-64
- fincm3
- intel-nuc
- jetson-nano
- beaglebone-black
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "2.1"

services:
wifi-connect:
image: balenablocks/wifi-connect:rpi
build: ./
restart: always
network_mode: host
privileged: true
Expand Down
16 changes: 12 additions & 4 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,26 @@ if [[ ! -z $CHECK_CONN_FREQ ]]
freq=120
fi

if [[ ! -z $SILENT ]]
then
verbose=0
else
verbose=1
fi

echo "WiFi Connect starting...\n"

sleep 5

while [[ true ]]; do
if [[ $VERBOSE != false ]]; then echo "Checking internet connectivity ..."; fi
if [ $verbose -eq 1 ]; then echo "Checking !!!!!! internet connectivity ..."; fi
wget --spider --no-check-certificate 1.1.1.1 > /dev/null 2>&1

if [ $? -eq 0 ]; then
if [[ $VERBOSE != false ]]; then echo "Your device is already connected to the internet.\nSkipping setting up Wifi-Connect Access Point. Will check again in $freq seconds."; fi
if [ $verbose -eq 1 ]; then echo "Your device is already connected to the internet.\nSkipping setting up Wifi-Connect Access Point. Will check again in $freq seconds."; fi
else
if [[ $VERBOSE != false ]]; then echo "Your device is not connected to the internet.\nStarting up Wifi-Connect.\n Connect to the Access Point and configure the SSID and Passphrase for the network to connect to."; fi
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket /usr/src/app/wifi-connect -u /usr/src/app/ui
if [ $verbose -eq 1 ]; then echo "Your device is not connected to the internet.\nStarting up Wifi-Connect.\n Connect to the Access Point and configure the SSID and Passphrase for the network to connect to."; fi
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket /usr/src/app/wifi-connect -u /usr/src/app/ui -o 3000
fi

sleep $freq
Expand Down