Skip to content

Instantly share code, notes, and snippets.

@ColGren
Created June 1, 2025 10:30
Show Gist options
  • Save ColGren/15e04973005a61c16234b6132000ebb9 to your computer and use it in GitHub Desktop.
Save ColGren/15e04973005a61c16234b6132000ebb9 to your computer and use it in GitHub Desktop.
Hazomatic set up
#!/bin/bash
set -e
echo "πŸ”§ Hazomatic WiFi Provisioning Setup"
# Detect architecture
ARCH=$(uname -m)
echo "Detected architecture: $ARCH"
if [[ "$ARCH" == "aarch64" ]]; then
WIFI_CONNECT_VERSION="v4.9.1"
WIFI_CONNECT_FILE="wifi-connect-${WIFI_CONNECT_VERSION}-linux-aarch64.zip"
elif [[ "$ARCH" == "armv7l" ]]; then
WIFI_CONNECT_VERSION="v4.11.3"
WIFI_CONNECT_FILE="wifi-connect-${WIFI_CONNECT_VERSION}-linux-rpi.zip"
else
echo "❌ Unsupported architecture: $ARCH"
exit 1
fi
# Download
DOWNLOAD_URL="https://github.com/balena-os/wifi-connect/releases/download/${WIFI_CONNECT_VERSION}/${WIFI_CONNECT_FILE}"
echo "Downloading wifi-connect ${WIFI_CONNECT_VERSION} for ${ARCH}..."
wget "$DOWNLOAD_URL"
echo "Unzipping..."
unzip "$WIFI_CONNECT_FILE"
echo "Installing to /usr/local/bin..."
sudo mv wifi-connect /usr/local/bin/
sudo chmod +x /usr/local/bin/wifi-connect
echo "βœ… Wifi-Connect installed:"
wifi-connect --version
# Clean up
rm "$WIFI_CONNECT_FILE"
rm -f LICENSE README.md
# Install avahi (for mDNS)
echo "Installing Avahi (mDNS support)..."
sudo apt update
sudo apt install -y avahi-daemon
sudo systemctl enable avahi-daemon
sudo systemctl start avahi-daemon
# Create systemd service
echo "Creating systemd service..."
SERVICE_FILE=/etc/systemd/system/wifi-connect.service
sudo bash -c "cat > $SERVICE_FILE" <<EOL
[Unit]
Description=WiFi Connect
After=network.target
[Service]
ExecStart=/usr/local/bin/wifi-connect
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOL
sudo systemctl enable wifi-connect
sudo systemctl start wifi-connect
echo "βœ… Wifi-Connect service installed and running."
# Done
echo "πŸŽ‰ Hazomatic WiFi provisioning complete!"
echo "🟒 On first boot, connect to device AP to configure Wi-Fi."
echo "🟒 Device will advertise as: $(hostname).local on your LAN"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment