Files
hassio-addons/scrutiny_fa/rootfs_overlay/etc/cont-init.d/90-run.sh
Alexandre bbaa0900a4 Fix Scrutiny 1.67 startup and InfluxDB migration (#2880)
* scrutiny: back up InfluxDB before 2.9 upgrade

* scrutiny: prepare InfluxDB 2.9 migration safely

* scrutiny: restore upstream s6 supervision

* scrutiny-fa: restore upstream s6 supervision

* scrutiny: validate backup contents before migration

* scrutiny: keep backup validation bounded

* scrutiny: document startup and migration fix

* scrutiny-fa: document startup and migration fix

* scrutiny: bump version to v1.67.0-3

* scrutiny-fa: bump version to v1.67.0-3

* scrutiny-fa: include migration helper in build context

* scrutiny-fa: copy migration helper explicitly

* scrutiny-fa: document build-context fix

* scrutiny-fa: bump version to v1.67.0-4

* scrutiny-fa: materialize Home Assistant rootfs overlay

* scrutiny-fa: use materialized rootfs overlay

* scrutiny-fa: bump version with changelog

* scrutiny: verify complete InfluxDB backup state

* scrutiny-fa: verify complete InfluxDB backup state

* scrutiny: support custom day intervals

* scrutiny-fa: support custom day intervals

* scrutiny: support absolute TLS paths

* scrutiny-fa: support absolute TLS paths

* scrutiny: harden collector configuration migration

* scrutiny-fa: harden collector configuration migration

* scrutiny: preserve legacy migration backups

* scrutiny-fa: preserve legacy migration backups

* scrutiny: restore initialization-only s6 hook

* scrutiny-fa: restore initialization-only s6 hook

* scrutiny: trigger reviewed release build

* scrutiny: finalize reviewed release

* scrutiny: finalize combined release metadata

* scrutiny: mark review-complete release

* scrutiny: normalize release metadata

* scrutiny: settle release metadata

* scrutiny: finalize metadata formatting

* scrutiny: synchronize reviewed release metadata

* scrutiny: run isolated reviewed build

* scrutiny-fa: run isolated reviewed build

* scrutiny: verify backup contents before migration

* scrutiny-fa: verify backup contents before migration

* scrutiny: test content-verified atomic backups

* scrutiny-fa: test content-verified atomic backups

* scrutiny: validate content-level backup integrity

* scrutiny: remove blocking FIFO test fixture

* scrutiny-fa: remove blocking FIFO test fixture

* scrutiny: run final content-integrity build

* scrutiny-fa: run final content-integrity build

* scrutiny: correct nginx readiness comment

* scrutiny-fa: correct nginx readiness comment

* scrutiny: skip collector symlinks during migration

* scrutiny-fa: skip collector symlinks during migration
2026-07-18 21:51:14 +02:00

57 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
#########################
# EXPOSE COLLECTOR.YAML #
#########################
if bashio::config.true "expose_collector"; then
bashio::log.info "collector.yaml exposed in /share/scrutiny"
mkdir -p /share/scrutiny
if [ -f /data/config/collector.yaml ] && [ ! -L /data/config/collector.yaml ]; then
if cp -n /data/config/collector.yaml /share/scrutiny; then
rm -f /data/config/collector.yaml
else
bashio::log.warning "Could not copy /data/config/collector.yaml; keeping the source file"
fi
fi
if [ -f /opt/scrutiny/config/collector.yaml ] && [ ! -L /opt/scrutiny/config/collector.yaml ]; then
if cp -n /opt/scrutiny/config/collector.yaml /share/scrutiny; then
rm -f /opt/scrutiny/config/collector.yaml
else
bashio::log.warning "Could not copy /opt/scrutiny/config/collector.yaml; keeping the source file"
fi
fi
touch /share/scrutiny/collector.yaml
ln -sf /share/scrutiny/collector.yaml /data/config || true
mkdir -p /opt/scrutiny/config
ln -sf /share/scrutiny/collector.yaml /opt/scrutiny/config/collector.yaml || true
chmod 755 -R /share/scrutiny
fi
########
# MODE #
########
if [[ "$(bashio::config "Mode")" == Collector ]]; then
# Clean services
bashio::log.warning "Collector only mode. WebUI and Influxdb will be disabled"
rm -rf /etc/services.d/influxdb
rm -rf /etc/services.d/scrutiny
rm -rf /etc/services.d/nginx
sed -i "/wait/d" /etc/services.d/collector-once/run
sed -i "/scrutiny api not ready/d" /etc/services.d/collector-once/run
# Check collector
if bashio::config.has_value "COLLECTOR_API_ENDPOINT"; then
echo "export COLLECTOR_API_ENDPOINT=$(bashio::config "COLLECTOR_API_ENDPOINT")" >> /env.sh
sed -i "1a export COLLECTOR_API_ENDPOINT=$(bashio::config "COLLECTOR_API_ENDPOINT")" /etc/services.d/collector-once/run
if [ -d /var/run/s6/container_environment ]; then printf "%s" "$COLLECTOR_API_ENDPOINT" > /var/run/s6/container_environment/COLLECTOR_API_ENDPOINT; fi
printf "%s\n" "IN_BACKGROUND=\"$COLLECTOR_API_ENDPOINT\"" >> ~/.bashrc
bashio::log.info "Using 'COLLECTOR_API_ENDPOINT' $(bashio::config "COLLECTOR_API_ENDPOINT")"
else
bashio::exit.nok "Mode is set to 'Collector', but 'COLLECTOR_API_ENDPOINT' is not defined"
fi
fi