fix: auto-fix linting issues

This commit is contained in:
alexbelgium
2025-08-17 00:34:15 +00:00
committed by github-actions[bot]
parent 205a7e9b84
commit 0d3c7619b4
28 changed files with 375 additions and 352 deletions

View File

@@ -131,7 +131,7 @@ validate_path() {
# Normalize path and check if it's within base path
local full_path="$base_path/$value"
local real_path
real_path=$(realpath -m "$full_path" 2>/dev/null || echo "$full_path")
real_path=$(realpath -m "$full_path" 2> /dev/null || echo "$full_path")
local real_base
real_base=$(realpath -m "$base_path")

102
.templates/bashio-standalone.sh Normal file → Executable file
View File

@@ -29,9 +29,12 @@ _bashio_color() {
_bashio_log() {
# $1=color name, $2...=msg
local c="$1"; shift
local pre; pre="$(_bashio_color "$c")"
local rst; rst="$(_bashio_color reset)"
local c="$1"
shift
local pre
pre="$(_bashio_color "$c")"
local rst
rst="$(_bashio_color reset)"
printf '%s%s%s\n' "$pre" "$*" "$rst"
}
@@ -42,12 +45,12 @@ _bashio_json_get() {
# $1=key (dot.notation). echoes value or empty; returns 0 always
local key="${1:-}"
local file="${STANDALONE_OPTIONS_JSON:-}"
if [ -z "$file" ] || [ ! -f "$file" ] || ! command -v jq >/dev/null 2>&1; then
if [ -z "$file" ] || [ ! -f "$file" ] || ! command -v jq > /dev/null 2>&1; then
return 0
fi
# jq -r returns "null" for missing; convert to empty
local val
val="$(jq -er --arg k "$key" '. as $r | getpath(($k|split("."))) // empty' "$file" 2>/dev/null || true)"
val="$(jq -er --arg k "$key" '. as $r | getpath(($k|split("."))) // empty' "$file" 2> /dev/null || true)"
[ "$val" = "null" ] && val=""
printf '%s' "$val"
}
@@ -66,7 +69,7 @@ _bashio_env_get() {
local variants=()
variants+=("$key")
variants+=("$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')")
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_' )")
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_')")
variants+=("$(printf '%s' "$key" | tr '.' '_' | tr '-' '_' | tr '[:lower:]' '[:upper:]')")
local prefixes=(""
@@ -88,7 +91,7 @@ _bashio_env_get() {
_bashio_is_true() {
# $1=value
case "${1:-}" in
1|true|TRUE|yes|YES|on|On) return 0 ;;
1 | true | TRUE | yes | YES | on | On) return 0 ;;
*) return 1 ;;
esac
}
@@ -100,7 +103,7 @@ _bashio_tcp_wait() {
local start now
start="$(date +%s)"
while :; do
if exec 3<>"/dev/tcp/${host}/${port}" 2>/dev/null; then
if exec 3<> "/dev/tcp/${host}/${port}" 2> /dev/null; then
exec 3>&- 3<&-
return 0
fi
@@ -140,10 +143,11 @@ bashio::supervisor.ping() {
bashio::addon.name() { printf '%s' "${ADDON_NAME:-Standalone container}"; }
bashio::addon.description() { printf '%s' "${ADDON_DESCRIPTION:-Running without Home Assistant Supervisor}"; }
bashio::addon.version() { printf '%s' "${BUILD_VERSION:-1.0}"; }
bashio::addon.version_latest(){ printf '%s' "${ADDON_VERSION_LATEST:-${BUILD_VERSION:-1.0}}"; }
bashio::addon.version_latest() { printf '%s' "${ADDON_VERSION_LATEST:-${BUILD_VERSION:-1.0}}"; }
bashio::addon.update_available() {
if [ "${ADDON_VERSION_LATEST:-}" != "" ] && [ "${ADDON_VERSION_LATEST:-}" != "${BUILD_VERSION:-}" ]; then
printf '%s' "true"; return 0
printf '%s' "true"
return 0
fi
printf '%s' "false"
}
@@ -178,7 +182,7 @@ bashio::info.operating_system() {
}
bashio::info.arch() { uname -m; }
bashio::info.machine() { uname -m; }
bashio::info.homeassistant(){ printf '%s' "standalone"; }
bashio::info.homeassistant() { printf '%s' "standalone"; }
bashio::info.supervisor() { printf '%s' "standalone"; }
# -------- config -------------------------------------------------------------
@@ -196,11 +200,17 @@ bashio::config() {
printf '%s' "${v:-}"
}
bashio::config.has_value() { local k="$1"; [ -n "$(bashio::config "$k")" ]; }
bashio::config.true() { local k="$1"; _bashio_is_true "$(bashio::config "$k")"; }
bashio::config.has_value() {
local k="$1"
[ -n "$(bashio::config "$k")" ]
}
bashio::config.true() {
local k="$1"
_bashio_is_true "$(bashio::config "$k")"
}
# Some add-ons call "require.ssl" (noop by default)
bashio::config.require.ssl(){ printf '%s' "${REQUIRE_SSL:-true}"; }
bashio::config.require.ssl() { printf '%s' "${REQUIRE_SSL:-true}"; }
# -------- variables & fs helpers --------------------------------------------
@@ -235,11 +245,11 @@ bashio::services() {
MQTT:USERNAME) var="MQTT_USER" ;;
MQTT:PASSWORD) var="MQTT_PASSWORD" ;;
MQTT:TLS) var="MQTT_TLS" ;;
MYSQL:HOST|MARIADB:HOST) var="DB_HOST" ;;
MYSQL:PORT|MARIADB:PORT) var="DB_PORT" ;;
MYSQL:USERNAME|MARIADB:USERNAME) var="DB_USER" ;;
MYSQL:PASSWORD|MARIADB:PASSWORD) var="DB_PASSWORD" ;;
MYSQL:DATABASE|MARIADB:DATABASE) var="DB_NAME" ;;
MYSQL:HOST | MARIADB:HOST) var="DB_HOST" ;;
MYSQL:PORT | MARIADB:PORT) var="DB_PORT" ;;
MYSQL:USERNAME | MARIADB:USERNAME) var="DB_USER" ;;
MYSQL:PASSWORD | MARIADB:PASSWORD) var="DB_PASSWORD" ;;
MYSQL:DATABASE | MARIADB:DATABASE) var="DB_NAME" ;;
*) var="${svc_upper}_${upper}" ;;
esac
@@ -259,15 +269,21 @@ mkdir -p "$_BASHIO_CACHE_DIR"
bashio::cache.exists() { [ -f "$_BASHIO_CACHE_DIR/${1}.cache" ]; }
bashio::cache.get() { [ -f "$_BASHIO_CACHE_DIR/${1}.cache" ] && cat "$_BASHIO_CACHE_DIR/${1}.cache"; }
bashio::cache.set() { mkdir -p "$_BASHIO_CACHE_DIR"; printf '%s' "${2:-}" > "$_BASHIO_CACHE_DIR/${1}.cache"; }
bashio::cache.set() {
mkdir -p "$_BASHIO_CACHE_DIR"
printf '%s' "${2:-}" > "$_BASHIO_CACHE_DIR/${1}.cache"
}
# Filesystem helpers frequently used
bashio::fs.file_exists() { [ -f "$1" ]; }
bashio::fs.directory_exists() { [ -d "$1" ]; } # already defined earlier; keep if present
bashio::fs.file_contains() { local f="$1" p="$2"; [ -f "$f" ] && grep -q -- "$p" "$f"; }
bashio::fs.file_contains() {
local f="$1" p="$2"
[ -f "$f" ] && grep -q -- "$p" "$f"
}
# jq wrapper (some add-ons call bashio::jq)
bashio::jq() { command -v jq >/dev/null 2>&1 && jq "$@"; }
bashio::jq() { command -v jq > /dev/null 2>&1 && jq "$@"; }
# env presence (even if empty) used by config.exists
_bashio_env_has() {
@@ -275,7 +291,7 @@ _bashio_env_has() {
[ -z "$key" ] && return 1
local variants=(
"$key"
"$(printf '%s' "$key" | tr '.' '_' )"
"$(printf '%s' "$key" | tr '.' '_')"
"$(printf '%s' "$key" | tr '.' '_' | tr '[:lower:]' '[:upper:]')"
"$(printf '%s' "$key" | tr '[:lower:]' '[:upper:]')"
)
@@ -295,8 +311,8 @@ _bashio_env_has() {
bashio::config.exists() {
local key="$1" file="${STANDALONE_OPTIONS_JSON:-}"
_bashio_env_has "$key" && return 0
if [ -n "$file" ] && command -v jq >/dev/null 2>&1; then
jq -e --arg k "$key" 'haspath(($k|split(".")))' "$file" >/dev/null 2>&1
if [ -n "$file" ] && command -v jq > /dev/null 2>&1; then
jq -e --arg k "$key" 'haspath(($k|split(".")))' "$file" > /dev/null 2>&1
return $?
fi
return 1
@@ -305,12 +321,13 @@ bashio::config.exists() {
# addon.option : write/delete option in JSON when possible; fallback no-op/env
bashio::addon.option() {
local key="$1" value="${2-__BASHIO_UNSET__}" file="${STANDALONE_OPTIONS_JSON:-}"
if [ -n "$file" ] && command -v jq >/dev/null 2>&1; then
local tmp; tmp="$(mktemp)"
if [ -n "$file" ] && command -v jq > /dev/null 2>&1; then
local tmp
tmp="$(mktemp)"
if [ "$value" = "__BASHIO_UNSET__" ]; then
jq --arg k "$key" 'delpath(($k|split(".")))' "$file" >"$tmp" && mv "$tmp" "$file"
jq --arg k "$key" 'delpath(($k|split(".")))' "$file" > "$tmp" && mv "$tmp" "$file"
else
jq --arg k "$key" --arg v "$value" 'setpath(($k|split(".")); $v)' "$file" >"$tmp" && mv "$tmp" "$file"
jq --arg k "$key" --arg v "$value" 'setpath(($k|split(".")); $v)' "$file" > "$tmp" && mv "$tmp" "$file"
fi
return 0
fi
@@ -322,7 +339,8 @@ bashio::addon.option() {
# services.available : check if we can resolve at least a host for the service
bashio::services.available() {
local svc="$1" host; host="$(bashio::services "$svc" "host")"
local svc="$1" host
host="$(bashio::services "$svc" "host")"
[ -n "$host" ]
}
@@ -332,7 +350,11 @@ bashio::var.has_value() { [ -n "${1:-}" ]; } # already present; keep if defined
# exits used by many add-ons
bashio::exit.ok() { exit 0; }
bashio::exit.nok() { local m="${1:-}"; [ -n "$m" ] && bashio::log.red "$m"; exit 1; }
bashio::exit.nok() {
local m="${1:-}"
[ -n "$m" ] && bashio::log.red "$m"
exit 1
}
# core.check : Supervisor does a config check; allow an overridable command
# Set STANDALONE_CORE_CHECK_CMD="hass --script check_config -c /config" to enable
@@ -354,10 +376,10 @@ fi
# net.wait_for: prefer nc if available, fallback to /dev/tcp
_bashio_tcp_wait_nc() {
# $1=host $2=port $3=timeout(s)
command -v nc >/dev/null 2>&1 || return 1
command -v nc > /dev/null 2>&1 || return 1
local host="$1" port="$2" to="${3:-30}"
# BusyBox and OpenBSD nc differ; cover both styles
nc -z -w "$to" "$host" "$port" 2>/dev/null || nc -z "$host" "$port" 2>/dev/null
nc -z -w "$to" "$host" "$port" 2> /dev/null || nc -z "$host" "$port" 2> /dev/null
}
bashio::net.wait_for() {
local host="$1" port="$2" to="${3:-30}"
@@ -369,24 +391,24 @@ bashio::net.wait_for() {
bashio::dns.host() {
local h="${1:-}"
[ -z "$h" ] && return 1
if command -v getent >/dev/null 2>&1; then
if command -v getent > /dev/null 2>&1; then
getent ahostsv4 "$h" | awk '{print $1; exit}'
else
# fallback: try busybox nslookup
nslookup "$h" 2>/dev/null | awk '/^Address: /{print $2; exit}'
nslookup "$h" 2> /dev/null | awk '/^Address: /{print $2; exit}'
fi
}
# Hostname
bashio::host.hostname() {
command -v hostname >/dev/null 2>&1 && hostname || printf '%s' "${HOSTNAME:-unknown}"
command -v hostname > /dev/null 2>&1 && hostname || printf '%s' "${HOSTNAME:-unknown}"
}
# Home Assistant token (no Supervisor; read from env or JSON)
bashio::homeassistant.token() {
local t="${HOMEASSISTANT_TOKEN:-${HASS_TOKEN:-}}"
if [ -z "$t" ] && [ -n "${STANDALONE_OPTIONS_JSON:-}" ] && command -v jq >/dev/null 2>&1; then
t="$(jq -er '.homeassistant.token // empty' "$STANDALONE_OPTIONS_JSON" 2>/dev/null || true)"
if [ -z "$t" ] && [ -n "${STANDALONE_OPTIONS_JSON:-}" ] && command -v jq > /dev/null 2>&1; then
t="$(jq -er '.homeassistant.token // empty' "$STANDALONE_OPTIONS_JSON" 2> /dev/null || true)"
fi
printf '%s' "${t:-}"
}
@@ -400,8 +422,8 @@ bashio::config.array() {
[ -z "$raw" ] && return 0
# JSON array?
if command -v jq >/dev/null 2>&1 && printf '%s' "$raw" | jq -e . >/dev/null 2>&1; then
printf '%s' "$raw" | jq -r '.[]' 2>/dev/null && return 0
if command -v jq > /dev/null 2>&1 && printf '%s' "$raw" | jq -e . > /dev/null 2>&1; then
printf '%s' "$raw" | jq -r '.[]' 2> /dev/null && return 0
fi
# CSV -> newline

View File

@@ -3,7 +3,6 @@
set -e # Exit immediately if a command exits with a non-zero status
# Detect if this is PID1 (main container process) — do this once at the start
PID1=false
if [ "$$" -eq 1 ]; then
@@ -38,7 +37,7 @@ for candidate in "${candidate_shebangs[@]}"; do
# Test if command exists and can actually execute a shell command (for shells)
if [ -x "$command_path" ]; then
# Try as both 'sh -c' and 'bashio echo' style
if "$command_path" -c 'echo yes' >/dev/null 2>&1 || "$command_path" echo "yes" >/dev/null 2>&1; then
if "$command_path" -c 'echo yes' > /dev/null 2>&1 || "$command_path" echo "yes" > /dev/null 2>&1; then
shebang="$candidate"
break
fi
@@ -103,7 +102,8 @@ if $PID1; then
sed -i -E 's|s6-svwait[[:space:]]+-d[[:space:]]+([^[:space:]]+)|bash -c '\''while [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile"
sed -i -E 's|s6-svwait[[:space:]]+-u[[:space:]]+([^[:space:]]+)|bash -c '\''until [ -f \1/supervise/pid ]; do sleep 0.5; done'\''|g' "$runfile"
chmod +x "$runfile"
( exec "$runfile" ) & true
(exec "$runfile") &
true
done
shopt -u nullglob
fi
@@ -119,19 +119,19 @@ if $PID1; then
terminate() {
echo "Termination signal received, forwarding to subprocesses..."
# Terminate all direct child processes
if command -v pgrep &>/dev/null; then
if command -v pgrep &> /dev/null; then
for pid in $(pgrep -P $$); do
echo "Terminating child PID $pid"
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
kill -TERM "$pid" 2> /dev/null || echo "Failed to terminate PID $pid"
done
else
# Fallback: Scan /proc for children
for pid in /proc/[0-9]*/; do
pid=${pid#/proc/}
pid=${pid%/}
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2>/dev/null; then
if [[ "$pid" -ne 1 ]] && grep -q "^PPid:\s*$$" "/proc/$pid/status" 2> /dev/null; then
echo "Terminating child PID $pid"
kill -TERM "$pid" 2>/dev/null || echo "Failed to terminate PID $pid"
kill -TERM "$pid" 2> /dev/null || echo "Failed to terminate PID $pid"
fi
done
fi

View File

@@ -73,9 +73,9 @@ if [ -n "${ALSA_CARD:-}" ]; then
fi
# Define permissions for audio
AUDIO_GID=$(stat -c %g /dev/snd/* | head -n1) && \
( groupmod -o -g "$AUDIO_GID" audio 2>/dev/null || groupadd -o -g "$AUDIO_GID" audio || true ) && \
usermod -aG audio "${USER:-pi}" || true
AUDIO_GID=$(stat -c %g /dev/snd/* | head -n1) \
&& (groupmod -o -g "$AUDIO_GID" audio 2> /dev/null || groupadd -o -g "$AUDIO_GID" audio || true) \
&& usermod -aG audio "${USER:-pi}" || true
# Fix timezone as per installer
CURRENT_TIMEZONE="$(timedatectl show --value --property=Timezone)"

View File

@@ -16,12 +16,12 @@
],
"name": "WIP - Collabora",
"options": {
"domain": "",
"username": "",
"password": "",
"aliasgroup1": "",
"dictionaries": "",
"extra_params": ""
"domain": "",
"extra_params": "",
"password": "",
"username": ""
},
"ports": {
"9980/tcp": 9980
@@ -30,13 +30,13 @@
"9980/tcp": "Web interface"
},
"schema": {
"domain": "str?",
"username": "str?",
"password": "password?",
"TZ": "str?",
"aliasgroup1": "str?",
"dictionaries": "str?",
"domain": "str?",
"extra_params": "str?",
"TZ": "str?"
"password": "password?",
"username": "str?"
},
"slug": "collabora",
"url": "https://github.com/alexbelgium/hassio-addons",

View File

@@ -48,7 +48,7 @@ ln -sf "${CONFIG_DEST}" "${COOL_CONFIG}"
SYSTEMPLATE_DIR="/opt/cool/systemplate/etc"
if [ -d "${SYSTEMPLATE_DIR}" ]; then
cp /etc/hosts "${SYSTEMPLATE_DIR}/hosts"
cp /etc/hostname "${SYSTEMPLATE_DIR}/hostname" 2>/dev/null || true
cp /etc/hostname "${SYSTEMPLATE_DIR}/hostname" 2> /dev/null || true
cp /etc/resolv.conf "${SYSTEMPLATE_DIR}/resolv.conf"
fi
chown 1001 /opt/cool/systemplate

0
emby/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

0
emby_beta/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -57,12 +57,12 @@ The web UI can be found at `<your-ip>:8071` or through the Home Assistant sideba
| `keyfile` | str | `privkey.pem` | SSL private key file (in `/ssl/`) |
| `NoAuth` | bool | `true` | Disable authentication (resets database when changed) |
| `disable_thumbnails` | bool | `true` | Disable thumbnail generation for improved performance |
| `base_folder` | str | *(optional)* | Root folder for file browser (defaults to all mapped folders) |
| `localdisks` | str | *(optional)* | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) |
| `networkdisks` | str | *(optional)* | SMB shares to mount (e.g., `//SERVER/SHARE`) |
| `cifsusername` | str | *(optional)* | SMB username for network shares |
| `cifspassword` | str | *(optional)* | SMB password for network shares |
| `cifsdomain` | str | *(optional)* | SMB domain for network shares |
| `base_folder` | str | _(optional)_ | Root folder for file browser (defaults to all mapped folders) |
| `localdisks` | str | _(optional)_ | Local drives to mount (e.g., `sda1,sdb1,MYNAS`) |
| `networkdisks` | str | _(optional)_ | SMB shares to mount (e.g., `//SERVER/SHARE`) |
| `cifsusername` | str | _(optional)_ | SMB username for network shares |
| `cifspassword` | str | _(optional)_ | SMB password for network shares |
| `cifsdomain` | str | _(optional)_ | SMB domain for network shares |
### Example Configuration

View File

@@ -78,12 +78,13 @@ environment:
}
image: ghcr.io/alexbelgium/grampsweb-{arch}
init: false
options: {
options:
{
"CELERY_NUM_WORKERS": 2,
"GUNICORN_NUM_WORKERS": 8,
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"ssl": false
"ssl": false,
}
map:
- type: addon_config

0
nextcloud/rootfs/etc/services.d/cron/run Normal file → Executable file
View File

0
nzbget/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -7,4 +7,4 @@
# Start omni-tools container content
bashio::log.info "Starting application"
/./docker-entrypoint.sh nginx -g "daemon off;" &>/proc/1/fd/1
/./docker-entrypoint.sh nginx -g "daemon off;" &> /proc/1/fd/1

View File

@@ -170,10 +170,10 @@
"cifspassword": "str?",
"cifsusername": "str?",
"claim": "str",
"clear_codecs_folder": "bool?",
"localdisks": "str?",
"networkdisks": "str?",
"skip_permissions_check": "bool?",
"clear_codecs_folder": "bool?",
"smbv1": "bool?"
},
"slug": "plex_nas",

View File

0
qbittorrent/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

0
qbittorrent/rootfs/etc/services.d/timer/run Normal file → Executable file
View File

0
scrutiny/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

0
sonarr/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

View File

@@ -98,6 +98,9 @@
"80/tcp": "Web interface"
},
"schema": {
"AI_API_KEY": "str?",
"AI_MODEL_NAME": "str?",
"AI_RATELIMIT": "str?",
"ALLOWED_HOSTS": "str?",
"DB_TYPE": "list(sqlite|postgresql_external)",
"DEBUG": "list(1|0)",
@@ -107,9 +110,6 @@
"POSTGRES_PORT": "str?",
"POSTGRES_USER": "str?",
"SECRET_KEY": "str",
"AI_MODEL_NAME": "str?",
"AI_API_KEY": "str?",
"AI_RATELIMIT": "str?",
"externalfiles_folder": "str?"
},
"services": [

View File

0
zzz_archived_bitwarden/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File