Netmaker add-on: pull prebuilt image from Gitea registry
Home Assistant add-on that joins the instance to a Netmaker network via netclient. Distributed as a repository add-on using a prebuilt arm64 image (gitea.savant.io/homeassistant/netmaker) to avoid local buildx. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
29
netmaker/rootfs/etc/s6-overlay/s6-rc.d/local-network/run
Normal file
29
netmaker/rootfs/etc/s6-overlay/s6-rc.d/local-network/run
Normal file
@ -0,0 +1,29 @@
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
export LOG_FD
|
||||
# ==============================================================================
|
||||
# Wait for the local network (default HA interface) to be ready
|
||||
# ==============================================================================
|
||||
|
||||
readonly WAIT_DELAY=5 # 5s
|
||||
readonly WAIT_COUNT=60 # 60*5s = 300s = 5m
|
||||
|
||||
declare wait_counter=0
|
||||
|
||||
# Some services need a working local network to function properly.
|
||||
# They can mark this service as dependency, and wait for the successful startup.
|
||||
|
||||
# Until HA has no default interface, we wait a little
|
||||
while ! bashio::api.supervisor GET "/network/interface/default/info" false &> /dev/null; do
|
||||
if (( wait_counter++ == WAIT_COUNT )); then
|
||||
# We emit only a warning to let the app start, maybe this is the only connection to access the device, better to start than not.
|
||||
# Let netclient figure out a way to connect to the network if the local network is temporarily down.
|
||||
bashio::log.warning "Local network (default Home Assistant interface) is unreachable"
|
||||
break
|
||||
fi
|
||||
bashio::log.info "Waiting for the local network (default Home Assistant interface) to be ready..."
|
||||
sleep $WAIT_DELAY
|
||||
done
|
||||
if (( wait_counter != 0 && wait_counter <= WAIT_COUNT )); then
|
||||
bashio::log.info "Local network is ready"
|
||||
fi
|
||||
Reference in New Issue
Block a user