Compare commits

...

10 Commits

Author SHA1 Message Date
github-actions
7a5463f9bc GitHub bot: changelog 2026-03-07 20:31:41 +00:00
Alexandre
accc11db99 Update config.yaml 2026-03-07 21:29:27 +01:00
Alexandre
b87beb9a08 Update 01-custom_script.sh 2026-03-07 21:28:55 +01:00
github-actions
8ea0ad30ea GitHub bot: changelog 2026-03-07 19:28:34 +00:00
Alexandre
e641b7fc80 Update version to 26.3.7-2 in config.yaml 2026-03-07 20:26:25 +01:00
Alexandre
9f0d8f3341 Merge pull request #2565 from alexbelgium/copilot/fix-netalertx-initial-screen-issue
Fix shebang probe rejecting valid interpreters when Supervisor API returns empty
2026-03-07 20:25:56 +01:00
copilot-swe-agent[bot]
43007282a4 Fix shebang probe rejecting valid interpreters when Supervisor API returns empty
The probe script requires bashio::addon.version to return non-empty output,
but the Supervisor API may not be ready during container init. This causes
all shebang candidates to be rejected even though the interpreter works fine.

Fix: output a 'PROBE_OK' marker when the script executes successfully but
the version is empty. Also check /.bashio-standalone.sh as fallback path
(some containers store it there instead of /usr/local/lib/).

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
2026-03-07 18:55:28 +00:00
copilot-swe-agent[bot]
50a7f44ff3 Address code review: capture exit code explicitly in fallback error message
Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
2026-03-07 09:24:10 +00:00
copilot-swe-agent[bot]
7cfe9a8770 Fix E2BIG error in ha_entrypoint.sh: add source fallback when exec fails with rc=126
When the environment is too large for exec (E2BIG), scripts fail with
'env: can't execute bashio: Argument list too long'. This adds a fallback
that sources the script in a subshell with bashio preloaded, avoiding exec
entirely. Applied to both init scripts and service runners.

Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
2026-03-07 09:22:47 +00:00
copilot-swe-agent[bot]
1b16b4b697 Initial plan 2026-03-07 09:07:12 +00:00
4 changed files with 96 additions and 40 deletions

View File

@@ -58,26 +58,30 @@ if ! command -v bashio::addon.version >/dev/null 2>&1; then
/usr/local/lib/bashio/bashio.sh
do
if [ -f "$f" ]; then
# shellcheck disable=SC1090
. "$f"
break
fi
done
fi
# Try regular bashio, fallback to standalone if unavailable or fails
set +e
_bv="$(bashio::addon.version 2>/dev/null)"
_rc=$?
set -e
if [ "$_rc" -ne 0 ] || [ -z "$_bv" ] || [ "$_bv" = "null" ]; then
if [ -f /usr/local/lib/bashio-standalone.sh ]; then
. /usr/local/lib/bashio-standalone.sh
_bv="$(bashio::addon.version)"
fi
for _sf in /usr/local/lib/bashio-standalone.sh /.bashio-standalone.sh; do
if [ -f "$_sf" ]; then
# shellcheck disable=SC1090
. "$_sf"
_bv="$(bashio::addon.version 2>/dev/null || true)"
break
fi
done
fi
echo "$_bv"
echo "${_bv:-PROBE_OK}"
'
validate_shebang() {
@@ -143,8 +147,6 @@ if [ -z "$shebang" ]; then
exit 1
fi
sed -i "1s|^.*|#!$shebang|" "$0"
if ! command -v bashio::addon.version >/dev/null 2>&1; then
for f in /usr/lib/bashio/bashio.sh /usr/lib/bashio/lib.sh /usr/src/bashio/bashio.sh /usr/local/lib/bashio/bashio.sh /usr/local/lib/bashio-standalone.sh; do
if [ -f "$f" ]; then
@@ -160,9 +162,9 @@ fi
##################
# Exit if /config is not mounted or HA not used
if [ ! -d /config ] || ! bashio::supervisor.ping 2> /dev/null; then
echo "..."
exit 0
if [ ! -d /config ] || ! bashio::supervisor.ping 2>/dev/null; then
echo "..."
exit 0
fi
# Define slug
@@ -171,13 +173,11 @@ slug="${slug#*_}"
# Check type of config folder
if [ ! -f /config/configuration.yaml ] && [ ! -f /config/configuration.json ]; then
# New config location
CONFIGLOCATION="/config"
CONFIGFILEBROWSER="/addon_configs/${HOSTNAME/-/_}/$slug.sh"
CONFIGLOCATION="/config"
CONFIGFILEBROWSER="/addon_configs/${HOSTNAME/-/_}/$slug.sh"
else
# Legacy config location
CONFIGLOCATION="/config/addons_autoscripts"
CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/$slug.sh"
CONFIGLOCATION="/config/addons_autoscripts"
CONFIGFILEBROWSER="/homeassistant/addons_autoscripts/$slug.sh"
fi
# Default location
@@ -189,26 +189,28 @@ bashio::log.green "Execute $CONFIGFILEBROWSER if existing"
# Download template if no script found and exit
if [ ! -f "$CONFIGSOURCE" ]; then
TEMPLATESOURCE="https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/script.template"
curl -f -L -s -S "$TEMPLATESOURCE" --output "$CONFIGSOURCE" || true
exit 0
TEMPLATESOURCE="https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/script.template"
curl -f -L -s -S "$TEMPLATESOURCE" --output "$CONFIGSOURCE" || true
exit 0
fi
# Convert scripts to linux
dos2unix "$CONFIGSOURCE" &> /dev/null || true
dos2unix "$CONFIGSOURCE" >/dev/null 2>&1 || true
chmod +x "$CONFIGSOURCE"
sed -i "1s|^.*|#!$shebang|" "$CONFIGSOURCE"
if grep -q 'bashio' "$CONFIGSOURCE"; then
sed -i "1s|^.*|#!$shebang|" "$CONFIGSOURCE"
else
sed -i '1s|^.*|#!/bin/bash|' "$CONFIGSOURCE"
fi
# Check if there is actual commands
while IFS= read -r line; do
# Remove leading and trailing whitespaces
line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
line="$(echo "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
# Check if line is not empty and does not start with #
if [[ -n "$line" ]] && [[ ! "$line" =~ ^# ]]; then
bashio::log.green "... script found, executing"
/."$CONFIGSOURCE"
break
fi
if [[ -n "$line" ]] && [[ ! "$line" =~ ^# ]]; then
bashio::log.green "... script found, executing"
"$CONFIGSOURCE"
break
fi
done < "$CONFIGSOURCE"

View File

@@ -90,14 +90,17 @@ _rc=$?
set -e
if [ "$_rc" -ne 0 ] || [ -z "$_bv" ] || [ "$_bv" = "null" ]; then
if [ -f /usr/local/lib/bashio-standalone.sh ]; then
# shellcheck disable=SC1091
. /usr/local/lib/bashio-standalone.sh
_bv="$(bashio::addon.version)"
fi
for _sf in /usr/local/lib/bashio-standalone.sh /.bashio-standalone.sh; do
if [ -f "$_sf" ]; then
# shellcheck disable=SC1090
. "$_sf"
_bv="$(bashio::addon.version 2>/dev/null || true)"
break
fi
done
fi
echo "$_bv"
echo "${_bv:-PROBE_OK}"
'
validate_shebang() {
@@ -165,6 +168,26 @@ if [ -z "$shebang" ]; then
exit 1
fi
####################################
# Bashio library for source fallback
####################################
BASHIO_LIB=""
for f in /usr/lib/bashio/bashio.sh /usr/lib/bashio/lib.sh /usr/src/bashio/bashio.sh /usr/local/lib/bashio/bashio.sh; do
if [ -f "$f" ]; then
BASHIO_LIB="$f"
break
fi
done
if [ -z "$BASHIO_LIB" ]; then
for f in /usr/local/lib/bashio-standalone.sh /.bashio-standalone.sh; do
if [ -f "$f" ]; then
BASHIO_LIB="$f"
break
fi
done
fi
####################
# Starting scripts #
####################
@@ -193,7 +216,23 @@ run_one_script() {
# shellcheck disable=SC1090
source "$script" || echo -e "\033[0;31mError\033[0m : $script exiting $?"
else
"$script" || echo -e "\033[0;31mError\033[0m : $script exiting $?"
_run_rc=0
"$script" || _run_rc=$?
if [ "$_run_rc" -eq 126 ] && [ -n "${BASHIO_LIB:-}" ]; then
echo "Direct exec failed (rc=126, likely E2BIG), retrying via source in subshell..."
_run_rc=0
(
# shellcheck disable=SC1090
. "$BASHIO_LIB" 2>/dev/null || true
# shellcheck disable=SC1090
. "$script"
) || _run_rc=$?
if [ "$_run_rc" -ne 0 ]; then
echo -e "\033[0;31mError\033[0m : $script exiting $_run_rc"
fi
elif [ "$_run_rc" -ne 0 ]; then
echo -e "\033[0;31mError\033[0m : $script exiting $_run_rc"
fi
fi
sed -i '1a exit 0' "$script"
@@ -217,8 +256,19 @@ if $PID1; then
restart_count=0
max_restarts=5
while true; do
"$runfile"
rc=$?
_svc_rc=0
"$runfile" || _svc_rc=$?
if [ "$_svc_rc" -eq 126 ] && [ -n "${BASHIO_LIB:-}" ]; then
echo "Direct exec of $runfile failed (rc=126, likely E2BIG), retrying via source..."
_svc_rc=0
(
# shellcheck disable=SC1090
. "$BASHIO_LIB" 2>/dev/null || true
# shellcheck disable=SC1090
. "$runfile"
) || _svc_rc=$?
fi
rc=$_svc_rc
if [ "$rc" -eq 0 ]; then
echo "$runfile exited cleanly (exit 0), not restarting."
break

View File

@@ -1,3 +1,7 @@
## 26.3.7-3 (07-03-2026)
- Minor bugs fixed
## 26.3.7-2 (07-03-2026)
- Minor bugs fixed
## 26.3.7 (2026-03-07)
- Update to latest version from jokob-sk/NetAlertX (changelog : https://github.com/jokob-sk/NetAlertX/releases)

View File

@@ -50,4 +50,4 @@ slug: netalertx
tmpfs: true
udev: true
url: https://github.com/alexbelgium/hassio-addons
version: "26.3.7"
version: "26.3.7-3"