Lint SC2236

This commit is contained in:
Alexandre
2025-04-08 10:59:10 +02:00
committed by GitHub
parent a78a28d66f
commit 83c51c9d84
5 changed files with 8 additions and 8 deletions

View File

@@ -18,8 +18,8 @@ if ! bashio::supervisor.ping 2>/dev/null; then
echo "... convert scripts to use environment variables instead of addon options" echo "... convert scripts to use environment variables instead of addon options"
while IFS= read -r scripts while IFS= read -r scripts
do do
sed -i -e 's/bashio::config.has_value[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ]/g' \ sed -i -e 's/bashio::config.has_value[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ -n "${\1:-}" ]/g' \
-e 's/bashio::config.true[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ ! -z "${\1:-}" ] \&\& [ "${\1:-}" = "true" ]/g' \ -e 's/bashio::config.true[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"']/[ -n "${\1:-}" ] \&\& [ "${\1:-}" = "true" ]/g' \
-e 's/\$(bashio::config[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"'])/${\1:-}/g' \ -e 's/\$(bashio::config[[:space:]]*["'"'"']\([^"'"'"']*\)["'"'"'])/${\1:-}/g' \
-e 's/\$(bashio::addon.port[[:space:]]*["'"'"']\([0-9]*\)["'"'"'])/${\1:-}/g' \ -e 's/\$(bashio::addon.port[[:space:]]*["'"'"']\([0-9]*\)["'"'"'])/${\1:-}/g' \
-e 's/bashio::config.require.ssl/true/g' \ -e 's/bashio::config.require.ssl/true/g' \
@@ -74,7 +74,7 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
PGID="$(bashio::config "PGID")" PGID="$(bashio::config "PGID")"
bashio::log.blue "User UID: $PUID" bashio::log.blue "User UID: $PUID"
bashio::log.blue "User GID: $PGID" bashio::log.blue "User GID: $PGID"
# Only modify user/group if they exist # Only modify user/group if they exist
if id abc &>/dev/null; then if id abc &>/dev/null; then
usermod -o -u "$PUID" abc &>/dev/null usermod -o -u "$PUID" abc &>/dev/null
@@ -82,7 +82,7 @@ if bashio::config.has_value "PUID" && bashio::config.has_value "PGID"; then
if getent group abc &>/dev/null; then if getent group abc &>/dev/null; then
groupmod -o -g "$PGID" abc &>/dev/null groupmod -o -g "$PGID" abc &>/dev/null
fi fi
bashio::log.blue \ bashio::log.blue \
'-----------------------------------------------------------' '-----------------------------------------------------------'
fi fi

View File

@@ -29,7 +29,7 @@ if bashio::config.has_value 'DNS_server'; then
# Only add DNS if there are DNS set # Only add DNS if there are DNS set
# shellcheck disable=SC2236 # shellcheck disable=SC2236
if [[ ! -z "$DNS" ]]; then if [[ -n "${DNS:-}" ]]; then
# Write resolv.conf # Write resolv.conf
# shellcheck disable=SC2059 # shellcheck disable=SC2059
printf "${DNS}" >/etc/resolv.conf printf "${DNS}" >/etc/resolv.conf

View File

@@ -39,7 +39,7 @@ done
# Avoid chmod /config if ha config mounted # Avoid chmod /config if ha config mounted
if [ -f /config/configuration.yaml ] || [ -f /config/configuration.json ]; then if [ -f /config/configuration.yaml ] || [ -f /config/configuration.json ]; then
for file in /etc/services.d/*/* /etc/cont-init.d/* /etc/s6-overlay/s6-rc.d/*/*; do for file in /etc/services.d/*/* /etc/cont-init.d/* /etc/s6-overlay/s6-rc.d/*/*; do
if [ -f "$file" ] && [ ! -z "$(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' "$file")" ]; then if [ -f "$file" ] && [ -n "$(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' "$file")" ]; then
sed -i "s|/config$|/data|g" "$file" sed -i "s|/config$|/data|g" "$file"
fi fi
done done

View File

@@ -58,7 +58,7 @@ else
fi || true fi || true
# Use ALSA CARD defined in add-on options if available # Use ALSA CARD defined in add-on options if available
if [ ! -z "${ALSA_CARD:-}" ]; then if [ -n "${ALSA_CARD:-}" ]; then
bashio::log.warning "ALSA_CARD is defined, the birdnet.conf is adapt to use device $ALSA_CARD" bashio::log.warning "ALSA_CARD is defined, the birdnet.conf is adapt to use device $ALSA_CARD"
for file in "$HOME"/BirdNET-Pi/birdnet.conf /config/birdnet.conf; do for file in "$HOME"/BirdNET-Pi/birdnet.conf /config/birdnet.conf; do
if [ -f "$file" ]; then if [ -f "$file" ]; then

View File

@@ -18,7 +18,7 @@ fi
filename="Spectrum_$(date "+%Y-%m-%d_%H:%M").wav" filename="Spectrum_$(date "+%Y-%m-%d_%H:%M").wav"
if [ ! -z "$RTSP_STREAM" ];then if [ -n "${RTSP_STREAM:-}" ];then
# Explode the RSPT steam setting into an array so we can count the number we have # Explode the RSPT steam setting into an array so we can count the number we have
RTSP_STREAMS_EXPLODED_ARRAY=("${RTSP_STREAM//,/ }") RTSP_STREAMS_EXPLODED_ARRAY=("${RTSP_STREAM//,/ }")