Files
hassio-addons/signalk/rootfs/etc/cont-init.d/99-run.sh
Claude 4754794968 Migrate bashio::addon.* to bashio::app.* (deprecated API)
bashio now emits deprecation warnings for bashio::addon.* calls.
This migrates all 227 call-sites across 86 files to use the new
bashio::app.* API.

Cross-compatibility is preserved in two ways:
1. bashio-standalone.sh: adds bashio::app.* functions that forward to
   bashio::addon.* (used when running without HA Supervisor).
   Also adds the missing ingress_url, restart and stop stubs.
2. ha_entrypoint.sh: injects a one-liner compat shim after the shebang
   of every cont-init and service script at container startup. On old
   bashio installations (bashio::app.* absent) the shim defines
   bashio::app.* as thin wrappers around bashio::addon.*; on new bashio
   the guard condition is true so the block is a no-op.

The probe script in ha_entrypoint.sh is also updated to try
bashio::app.version before falling back to bashio::addon.version.

https://claude.ai/code/session_011FWFBhYQ6VS5FauSqv4UMo
2026-06-08 17:32:43 +00:00

48 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bashio
# shellcheck shell=bash
set -e
# hadolint ignore=SC2155
# Set configuration directory
if [ -d "/home/node/.signalk" ]; then
rm -r "/home/node/.signalk"
fi
# Variables
USER=node
echo "... creating symlinks and checking permissions"
ln -sf /config "/home/node/.signalk"
chown -R "$USER:$USER" /config
# Set permissions
# Use sed instead of usermod/groupmod to avoid hangs in container environments
# (usermod can block indefinitely due to lock contention, NSS, or PAM issues)
echo "... setting permissions for node user"
sed -i 's/^\(node:[^:]*:\)[0-9]*:[0-9]*/\10:0/' /etc/passwd
sed -i 's/^\(node:[^:]*:\)[0-9]*/\10/' /etc/group
# Ensure 600 for SSL files
echo "... specifying security files permissions"
for file in ssl-key.pem ssl-cert.pem security.json; do
if [ -e "/config/$file" ]; then
chmod 600 "/config/$file"
fi
done
# Rebuild npm dependency bindings on version change
current_version="$(bashio::app.version)"
if [[ ! -f /data/version || "$current_version" != "$(cat /data/version)" ]]; then
if [[ -f /config/package.json ]]; then
bashio::log.info "Update detected, rebuilding native node deps"
cd /config
npm rebuild
echo "$current_version" > /data/version
else
bashio::log.warning "Update detected, but /config/package.json is missing; skipping npm rebuild"
fi
fi
bashio::log.info "Starting application"
sudo -u "$USER" -s /bin/sh -c "/home/node/signalk/startup.sh"