fix: auto-fix linting issues

This commit is contained in:
alexbelgium
2025-07-23 08:58:09 +00:00
committed by github-actions[bot]
parent 3539f328fb
commit f5428e0950
224 changed files with 5663 additions and 5662 deletions

View File

@@ -20,9 +20,9 @@ ln -s "$DATABASELOCATION"/influxdb /opt/scrutiny
###############################
if [ -f /data/scrutiny.db ]; then
bashio::log.warning "Previous database detected, migration will start. Backup stored in /share/scrutiny.db.bak"
cp /data/scrutiny.db /share/scrutiny.db.bak
mv /data/scrutiny.db "$DATABASELOCATION"/config/
bashio::log.warning "Previous database detected, migration will start. Backup stored in /share/scrutiny.db.bak"
cp /data/scrutiny.db /share/scrutiny.db.bak
mv /data/scrutiny.db "$DATABASELOCATION"/config/
fi
######
@@ -31,9 +31,9 @@ fi
# Align timezone with options
if bashio::config.has_value "TZ"; then
TZ="$(bashio::config 'TZ')"
bashio::log.info "Timezone : $TZ"
sed -i "1a export TZ=$TZ" /etc/cont-init.d/01-timezone
TZ="$(bashio::config 'TZ')"
bashio::log.info "Timezone : $TZ"
sed -i "1a export TZ=$TZ" /etc/cont-init.d/01-timezone
fi
################
@@ -45,71 +45,71 @@ FREQUENCY="$(bashio::config 'Updates')"
bashio::log.info "$FREQUENCY updates as defined in the 'Updates' option"
case "$FREQUENCY" in
"Quarterly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"*/15 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Quarterly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"*/15 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Hourly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Hourly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 * * * *\"" /etc/cont-init.d/50-cron-config
;;
"Daily")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
;;
"Daily")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * *\"" /etc/cont-init.d/50-cron-config
;;
"Weekly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
;;
"Weekly")
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"0 0 * * 0\"" /etc/cont-init.d/50-cron-config
;;
"Custom")
interval="$(bashio::config 'Updates_custom_time')"
bashio::log.info "... frequency is defined manually as $interval"
"Custom")
interval="$(bashio::config 'Updates_custom_time')"
bashio::log.info "... frequency is defined manually as $interval"
case "$interval" in
*m) # Matches intervals in minutes, like "5m" or "30m"
minutes="${interval%m}"
if [[ "$minutes" -gt 0 && "$minutes" -le 59 ]]; then
cron_schedule="*/$minutes * * * *"
else
bashio::log.error "Invalid minute interval: $interval"
fi
;;
case "$interval" in
*m) # Matches intervals in minutes, like "5m" or "30m"
minutes="${interval%m}"
if [[ "$minutes" -gt 0 && "$minutes" -le 59 ]]; then
cron_schedule="*/$minutes * * * *"
else
bashio::log.error "Invalid minute interval: $interval"
fi
;;
*h) # Matches intervals in hours, like "2h"
hours="${interval%h}"
if [[ "$hours" -gt 0 && "$hours" -le 23 ]]; then
cron_schedule="0 */$hours * * *"
else
bashio::log.error "Invalid hour interval: $interval"
fi
;;
*h) # Matches intervals in hours, like "2h"
hours="${interval%h}"
if [[ "$hours" -gt 0 && "$hours" -le 23 ]]; then
cron_schedule="0 */$hours * * *"
else
bashio::log.error "Invalid hour interval: $interval"
fi
;;
*w) # Matches intervals in weeks, like "1w"
weeks="${interval%w}"
if [[ "$weeks" -gt 0 && "$weeks" -le 4 ]]; then
cron_schedule="0 0 * * 0" # Weekly on Sunday (adjust if needed for multi-week)
else
bashio::log.error "Invalid week interval: $interval"
fi
;;
*w) # Matches intervals in weeks, like "1w"
weeks="${interval%w}"
if [[ "$weeks" -gt 0 && "$weeks" -le 4 ]]; then
cron_schedule="0 0 * * 0" # Weekly on Sunday (adjust if needed for multi-week)
else
bashio::log.error "Invalid week interval: $interval"
fi
;;
*mo) # Matches intervals in months, like "1mo"
months="${interval%mo}"
if [[ "$months" -gt 0 && "$months" -le 12 ]]; then
cron_schedule="0 0 1 */$months *" # Monthly on the 1st
else
bashio::log.error "Invalid month interval: $interval"
fi
;;
*mo) # Matches intervals in months, like "1mo"
months="${interval%mo}"
if [[ "$months" -gt 0 && "$months" -le 12 ]]; then
cron_schedule="0 0 1 */$months *" # Monthly on the 1st
else
bashio::log.error "Invalid month interval: $interval"
fi
;;
*)
bashio::log.error "Empty or unsupported custom interval. It should be in the format of 5m (every 5 minutes), 10d (every 10 days), 3w (every 3 weeks), 3mo (every 3 months)"
;;
esac
*)
bashio::log.error "Empty or unsupported custom interval. It should be in the format of 5m (every 5 minutes), 10d (every 10 days), 3w (every 3 weeks), 3mo (every 3 months)"
;;
esac
if [[ -n "$cron_schedule" ]]; then
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"$cron_schedule\"" /etc/cont-init.d/50-cron-config
bashio::log.info "Custom cron schedule set to: $cron_schedule"
fi
;;
if [[ -n "$cron_schedule" ]]; then
sed -i "/customize the cron schedule/a export COLLECTOR_CRON_SCHEDULE=\"$cron_schedule\"" /etc/cont-init.d/50-cron-config
bashio::log.info "Custom cron schedule set to: $cron_schedule"
fi
;;
esac

View File

@@ -13,19 +13,19 @@ declare keyfile
port=$(bashio::addon.port 80)
if bashio::var.has_value "${port}"; then
bashio::config.require.ssl
bashio::config.require.ssl
if bashio::config.true 'ssl'; then
certfile=$(bashio::config 'certfile')
keyfile=$(bashio::config 'keyfile')
if bashio::config.true 'ssl'; then
certfile=$(bashio::config 'certfile')
keyfile=$(bashio::config 'keyfile')
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
else
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
fi
else
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
fi
fi
ingress_port=$(bashio::addon.ingress_port)

View File

@@ -7,21 +7,21 @@ set -e
#########################
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 ]; then
cp -rnf /data/config/collector.yaml /share/scrutiny || true
rm -R /data/config/collector.yaml
fi
if [ -f /opt/scrutiny/config/collector.yaml ]; then
cp -rnf /opt/scrutiny/config/collector.yaml /share/scrutiny || true
rm /opt/scrutiny/config/collector.yaml
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 777 -R /share/scrutiny
bashio::log.info "collector.yaml exposed in /share/scrutiny"
mkdir -p /share/scrutiny
if [ -f /data/config/collector.yaml ]; then
cp -rnf /data/config/collector.yaml /share/scrutiny || true
rm -R /data/config/collector.yaml
fi
if [ -f /opt/scrutiny/config/collector.yaml ]; then
cp -rnf /opt/scrutiny/config/collector.yaml /share/scrutiny || true
rm /opt/scrutiny/config/collector.yaml
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 777 -R /share/scrutiny
fi
########
@@ -29,22 +29,22 @@ fi
########
if [[ "$(bashio::config "Mode")" == Collector ]]; then
# Clean services
bashio::log.warning "Collector only mode. WebUI and Influxdb will be disabled"
rm -r /etc/services.d/influxdb
rm -r /etc/services.d/scrutiny
rm -r /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
# Clean services
bashio::log.warning "Collector only mode. WebUI and Influxdb will be disabled"
rm -r /etc/services.d/influxdb
rm -r /etc/services.d/scrutiny
rm -r /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
# 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

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