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

@@ -3,9 +3,9 @@
set -e
if bashio::config.has_value 'CONFIG_LOCATION'; then
CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')"
# Modify if it is a base directory
if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname "$CONFIG_LOCATION")"; fi
CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')"
# Modify if it is a base directory
if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname "$CONFIG_LOCATION")"; fi
fi
CONFIG_LOCATION=$(bashio::config 'CONFIG_LOCATION')
@@ -16,5 +16,5 @@ chown -R "$PUID:$PGID" "$CONFIG_LOCATION"
# shellcheck disable=SC2013
for file in $(grep -sril "/config/addons_config/readarr" /etc /defaults); do
sed -i "s|/config/addons_config/readarr|$CONFIG_LOCATION|g" "$file"
sed -i "s|/config/addons_config/readarr|$CONFIG_LOCATION|g" "$file"
done

View File

@@ -1,32 +1,32 @@
#!/bin/bash
if [ ! -d /share/storage/ebook ]; then
echo "Creating /share/storage/ebook"
mkdir -p /share/storage/ebook
chown -R "$PUID:$PGID" /share/storage/ebook
echo "Creating /share/storage/ebook"
mkdir -p /share/storage/ebook
chown -R "$PUID:$PGID" /share/storage/ebook
fi
if [ ! -d /share/downloads ]; then
echo "Creating /share/downloads"
mkdir -p /share/downloads
chown -R "$PUID:$PGID" /share/downloads
echo "Creating /share/downloads"
mkdir -p /share/downloads
chown -R "$PUID:$PGID" /share/downloads
fi
if [ -d /config/readarr ] && [ ! -d /config/addons_config/readarr ]; then
echo "Moving to new location /config/addons_config/readarr"
mkdir -p /config/addons_config/readarr
chown -R "$PUID:$PGID" /config/addons_config/readarr
mv /config/readarr/* /config/addons_config/readarr/
rm -r /config/readarr
echo "Moving to new location /config/addons_config/readarr"
mkdir -p /config/addons_config/readarr
chown -R "$PUID:$PGID" /config/addons_config/readarr
mv /config/readarr/* /config/addons_config/readarr/
rm -r /config/readarr
fi
if [ ! -d /config/addons_config/readarr ]; then
echo "Creating /config/addons_config/readarr"
mkdir -p /config/addons_config/readarr
chown -R "$PUID:$PGID" /config/addons_config/readarr
echo "Creating /config/addons_config/readarr"
mkdir -p /config/addons_config/readarr
chown -R "$PUID:$PGID" /config/addons_config/readarr
fi
if [ -d /config/addons_config/readarr/readarr ]; then
mv /config/addons_config/readarr/readarr/{.,}* /config/addons_config/readarr/
rmdir /config/addons_config/readarr/readarr
mv /config/addons_config/readarr/readarr/{.,}* /config/addons_config/readarr/
rmdir /config/addons_config/readarr/readarr
fi

View File

@@ -25,41 +25,41 @@ CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
if [ -f "$CONFIG_LOCATION" ]; then
# Define addon mode
connection_mode="$(bashio::config "connection_mode")"
bashio::log.green "---------------------------"
bashio::log.green "Connection_mode is $connection_mode"
bashio::log.green "---------------------------"
case "$connection_mode" in
# Ingress mode, authentification is disabled
ingress_noauth)
bashio::log.green "Ingress is enabled, authentification is disabled"
bashio::log.yellow "WARNING : Make sure that the port is not exposed externally by your router to avoid a security risk !"
# Define UrlBase
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
# Disable local auth
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
# Disable local auth
sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
;;
# Ingress mode, with authentification
ingress_auth)
bashio::log.green "Ingress is enabled, and external authentification is enabled"
# Define UrlBase
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
;;
# No ingress mode, with authentification
noingress_auth)
bashio::log.green "Disabling ingress and enabling authentification"
bashio::log.yellow "WARNING : Ingress is disabled so the app won't be available from HA itself !"
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
;;
esac
# Define addon mode
connection_mode="$(bashio::config "connection_mode")"
bashio::log.green "---------------------------"
bashio::log.green "Connection_mode is $connection_mode"
bashio::log.green "---------------------------"
case "$connection_mode" in
# Ingress mode, authentification is disabled
ingress_noauth)
bashio::log.green "Ingress is enabled, authentification is disabled"
bashio::log.yellow "WARNING : Make sure that the port is not exposed externally by your router to avoid a security risk !"
# Define UrlBase
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
# Disable local auth
sed -i "/AuthenticationType/d" "$CONFIG_LOCATION"
sed -i "2a <AuthenticationType>DisabledForLocalAddresses</AuthenticationType>" "$CONFIG_LOCATION"
# Disable local auth
sed -i "/AuthenticationMethod/d" "$CONFIG_LOCATION"
sed -i "2a <AuthenticationMethod>external</AuthenticationMethod>" "$CONFIG_LOCATION"
;;
# Ingress mode, with authentification
ingress_auth)
bashio::log.green "Ingress is enabled, and external authentification is enabled"
# Define UrlBase
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "2a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
;;
# No ingress mode, with authentification
noingress_auth)
bashio::log.green "Disabling ingress and enabling authentification"
bashio::log.yellow "WARNING : Ingress is disabled so the app won't be available from HA itself !"
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "/<AuthenticationMethod>external/d" "$CONFIG_LOCATION"
;;
esac
fi

26
readarr/rootfs/etc/services.d/nginx/run Normal file → Executable file
View File

@@ -12,32 +12,32 @@ CONFIG_LOCATION=/config/addons_config/"$slug"/config.xml
bashio::net.wait_for "$port" localhost 900
if bashio::config.has_value 'CONFIG_LOCATION'; then
CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')"
# Modify if it is a base directory
if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname $CONFIG_LOCATION)"; fi
CONFIG_LOCATION="$CONFIG_LOCATION"/config.xml
CONFIG_LOCATION="$(bashio::config 'CONFIG_LOCATION')"
# Modify if it is a base directory
if [[ "$CONFIG_LOCATION" == *.* ]]; then CONFIG_LOCATION="$(dirname $CONFIG_LOCATION)"; fi
CONFIG_LOCATION="$CONFIG_LOCATION"/config.xml
fi
# Delete external
if grep -q "external" "$CONFIG_LOCATION"; then
bashio::log.warning "external is set, restarting"
sed -i "/external/d" "$CONFIG_LOCATION"
bashio::addon.restart
bashio::log.warning "external is set, restarting"
sed -i "/external/d" "$CONFIG_LOCATION"
bashio::addon.restart
fi
# Set UrlBase
if ! grep -q "<UrlBase>$slug</UrlBase>" "$CONFIG_LOCATION" && ! bashio::config.true "ingress_disabled"; then
bashio::log.warning "BaseUrl not set properly, restarting"
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "/<Config>/a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
bashio::addon.restart
bashio::log.warning "BaseUrl not set properly, restarting"
sed -i "/UrlBase/d" "$CONFIG_LOCATION"
sed -i "/<Config>/a <UrlBase>$slug<\/UrlBase>" "$CONFIG_LOCATION"
bashio::addon.restart
fi
echo ""
if bashio::config.true "ingress_disabled"; then
bashio::log.info "Ingress is disabled. You can connect at http://homeassistant:$(bashio::addon.port 8787)"
bashio::log.info "Ingress is disabled. You can connect at http://homeassistant:$(bashio::addon.port 8787)"
else
bashio::log.info "Ingress is enabled. You can connect from HA or at http://homeassistant:$(bashio::addon.port 8787)/readarr"
bashio::log.info "Ingress is enabled. You can connect from HA or at http://homeassistant:$(bashio::addon.port 8787)/readarr"
fi
echo ""