From 3db34e34f26a27edf28aac7aba26adb60db28902 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 18 Feb 2022 13:06:51 +0100 Subject: [PATCH] lint --- .templates/00-banner.sh | 1 - .../etc/cont-init.d/89-mqtt_autodiscover.sh | 8 +-- .../etc/cont-init.d/00-data_location.sh | 5 +- jellyfin/rootfs/etc/cont-init.d/20-folders.sh | 61 ++++++++++--------- .../etc/cont-init.d/20-configuration.sh | 1 + spotweb/rootfs/etc/cont-init.d/90-spotweb | 5 +- spotweb/rootfs/etc/periodic/daily/check-cache | 1 + spotweb/rootfs/etc/periodic/hourly/spotweb | 1 + spotweb/rootfs/etc/services.d/nginx/run | 1 + spotweb/rootfs/etc/services.d/phpfpm/run | 1 + .../etc/cont-init.d/00-data_location.sh | 3 +- .../etc/cont-init.d/80-configuration.sh | 3 +- 12 files changed, 50 insertions(+), 41 deletions(-) diff --git a/.templates/00-banner.sh b/.templates/00-banner.sh index e62c33b9f..f60853346 100644 --- a/.templates/00-banner.sh +++ b/.templates/00-banner.sh @@ -1,5 +1,4 @@ #!/usr/bin/with-contenv bashio - # shellcheck shell=bash # ============================================================================== # Displays a simple add-on banner on startup diff --git a/gazpar2mqtt/rootfs/etc/cont-init.d/89-mqtt_autodiscover.sh b/gazpar2mqtt/rootfs/etc/cont-init.d/89-mqtt_autodiscover.sh index f4ce6f2c7..c2c6ddc5c 100644 --- a/gazpar2mqtt/rootfs/etc/cont-init.d/89-mqtt_autodiscover.sh +++ b/gazpar2mqtt/rootfs/etc/cont-init.d/89-mqtt_autodiscover.sh @@ -12,15 +12,15 @@ if bashio::config.true 'mqtt_autodiscover'; then # Get variables bashio::log.info "... MQTT service found, fetching server detail (you can enter those manually in your config file) ..." MQTT_HOST=$(bashio::services mqtt "host") - export MQTT_HOST + export MQTT_HOST MQTT_PORT=$(bashio::services mqtt "port") - export MQTT_PORT + export MQTT_PORT MQTT_SSL=$(bashio::services mqtt "ssl") - export MQTT_SSL + export MQTT_SSL MQTT_USERNAME=$(bashio::services mqtt "username") export MQTT_USERNAME MQTT_PASSWORD=$(bashio::services mqtt "password") - export MQTT_PASSWORD + export MQTT_PASSWORD # Export variables for variables in "MQTT_HOST=$MQTT_HOST" "MQTT_PORT=$MQTT_PORT" "MQTT_SSL=$MQTT_SSL" "MQTT_USERNAME=$MQTT_USERNAME" "MQTT_PASSWORD=$MQTT_PASSWORD"; do sed -i "1a export $variables" /etc/services.d/*/*run* 2>/dev/null || true diff --git a/jellyfin/rootfs/etc/cont-init.d/00-data_location.sh b/jellyfin/rootfs/etc/cont-init.d/00-data_location.sh index c644acd7a..ffb8359ed 100644 --- a/jellyfin/rootfs/etc/cont-init.d/00-data_location.sh +++ b/jellyfin/rootfs/etc/cont-init.d/00-data_location.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # Define user PUID=$(bashio::config "PUID") @@ -9,7 +10,7 @@ LOCATION=$(bashio::config 'data_location') if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then LOCATION=/config/addons_config/${HOSTNAME#*-}; fi # Set data location -bashio::log.info "Setting data location to $LOCATION" +bashio::log.info "Setting data location to $LOCATION" sed -i "s|/config|$LOCATION|g" /etc/services.d/jellyfin/run sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/10-adduser sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/30-config @@ -17,5 +18,5 @@ sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/30-config echo "Creating $LOCATION" mkdir -p "$LOCATION" -bashio::log.info "Setting ownership to $PUID:$PGID" +bashio::log.info "Setting ownership to $PUID:$PGID" chown "$PUID":"$PGID" "$LOCATION" diff --git a/jellyfin/rootfs/etc/cont-init.d/20-folders.sh b/jellyfin/rootfs/etc/cont-init.d/20-folders.sh index 1bf5d47cd..930f02920 100644 --- a/jellyfin/rootfs/etc/cont-init.d/20-folders.sh +++ b/jellyfin/rootfs/etc/cont-init.d/20-folders.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash LOCATION=$(bashio::config 'data_location') @@ -8,64 +9,64 @@ if [ ! -d /jellyfin ]; then chown -R abc:abc /jellyfin fi -if [ ! -d $LOCATION/tv ]; then - echo "Creating $LOCATION/tv" - mkdir -p $LOCATION/tv - chown -R abc:abc $LOCATION/tv +if [ ! -d "$LOCATION"/tv ]; then + echo "Creating "$LOCATION"/tv" + mkdir -p "$LOCATION"/tv + chown -R abc:abc "$LOCATION"/tv fi -if [ ! -d $LOCATION/movies ]; then - echo "Creating $LOCATION/movies" - mkdir -p $LOCATION/movies - chown -R abc:abc $LOCATION/movies +if [ ! -d "$LOCATION"/movies ]; then + echo "Creating "$LOCATION"/movies" + mkdir -p "$LOCATION"/movies + chown -R abc:abc "$LOCATION"/movies fi -if [ ! -d $LOCATION ]; then - echo "Creating $LOCATION" - mkdir -p $LOCATION - chown -R abc:abc $LOCATION +if [ ! -d "$LOCATION" ]; then + echo "Creating "$LOCATION"" + mkdir -p "$LOCATION" + chown -R abc:abc "$LOCATION" fi # links if [ ! -d /jellyfin/cache ]; then echo "Creating link for /jellyfin/cache" - mkdir -p $LOCATION/cache - chown -R abc:abc $LOCATION/cache - ln -s $LOCATION/cache /jellyfin/cache + mkdir -p "$LOCATION"/cache + chown -R abc:abc "$LOCATION"/cache + ln -s "$LOCATION"/cache /jellyfin/cache fi if [ ! -d /jellyfin/data ]; then echo "Creating link for /jellyfin/data" - mkdir -p $LOCATION/data - chown -R abc:abc $LOCATION/data - ln -s $LOCATION/data /jellyfin/data + mkdir -p "$LOCATION"/data + chown -R abc:abc "$LOCATION"/data + ln -s "$LOCATION"/data /jellyfin/data fi if [ ! -d /jellyfin/logs ]; then echo "Creating link for /jellyfin/logs" - mkdir -p $LOCATION/logs - chown -R abc:abc $LOCATION/logs - ln -s $LOCATION/logs /jellyfin/logs + mkdir -p "$LOCATION"/logs + chown -R abc:abc "$LOCATION"/logs + ln -s "$LOCATION"/logs /jellyfin/logs fi if [ ! -d /jellyfin/metadata ]; then echo "Creating link for /jellyfin/metadata" - mkdir -p $LOCATION/metadata - chown -R abc:abc $LOCATION/metadata - ln -s $LOCATION/metadata /jellyfin/metadata + mkdir -p "$LOCATION"/metadata + chown -R abc:abc "$LOCATION"/metadata + ln -s "$LOCATION"/metadata /jellyfin/metadata fi if [ ! -d /jellyfin/plugins ]; then echo "Creating link for /jellyfin/plugins" - mkdir -p $LOCATION/plugins - chown -R abc:abc $LOCATION/plugins - ln -s $LOCATION/plugins /jellyfin/plugins + mkdir -p "$LOCATION"/plugins + chown -R abc:abc "$LOCATION"/plugins + ln -s "$LOCATION"/plugins /jellyfin/plugins fi if [ ! -d /jellyfin/root ]; then echo "Creating link for /jellyfin/root" - mkdir -p $LOCATION/root - chown -R abc:abc $LOCATION/root - ln -s $LOCATION/root /jellyfin/root + mkdir -p "$LOCATION"/root + chown -R abc:abc "$LOCATION"/root + ln -s "$LOCATION"/root /jellyfin/root fi diff --git a/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh b/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh index a3208e5c0..7e36428cd 100644 --- a/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh +++ b/plex_meta_manager/rootfs/etc/cont-init.d/20-configuration.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # Where is the config CONFIGSOURCE=$(bashio::config "PMM_CONFIG") diff --git a/spotweb/rootfs/etc/cont-init.d/90-spotweb b/spotweb/rootfs/etc/cont-init.d/90-spotweb index a0a503dda..9e6cdd2dd 100644 --- a/spotweb/rootfs/etc/cont-init.d/90-spotweb +++ b/spotweb/rootfs/etc/cont-init.d/90-spotweb @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: spotweb # This file validates config and creates the database @@ -54,7 +55,7 @@ else password=$(bashio::services mysql "password") # password='spotweb' # username='spotweb' - + bashio::log.warning "Spotweb is using the Maria DB addon" bashio::log.warning "Please ensure this is included in your backups" bashio::log.warning "Uninstalling the MariaDB addon will remove any data" @@ -91,7 +92,7 @@ if [ "$RESULT" == "$dbname" ]; then # database already exists, do healthcheck with upgrade-db bashio::log.info "Existing database, clearing cache with upgrade-db" bashio::log.info "to fix potential cache corruption..." - s6-setuidgid nginx php8 /app/bin/upgrade-db.php --clear-cache -yes >/dev/null + s6-setuidgid nginx php8 /app/bin/upgrade-db.php --clear-cache -yes >/dev/null else # database does not yet exist bashio::log.info "Creating database with default settings...." diff --git a/spotweb/rootfs/etc/periodic/daily/check-cache b/spotweb/rootfs/etc/periodic/daily/check-cache index b350500b8..2c9372e79 100644 --- a/spotweb/rootfs/etc/periodic/daily/check-cache +++ b/spotweb/rootfs/etc/periodic/daily/check-cache @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Runs the daily task to check the spotweb cache # ============================================================================== diff --git a/spotweb/rootfs/etc/periodic/hourly/spotweb b/spotweb/rootfs/etc/periodic/hourly/spotweb index 7a52f68de..66a493f9f 100644 --- a/spotweb/rootfs/etc/periodic/hourly/spotweb +++ b/spotweb/rootfs/etc/periodic/hourly/spotweb @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Runs the hourly task to update spots # ============================================================================== diff --git a/spotweb/rootfs/etc/services.d/nginx/run b/spotweb/rootfs/etc/services.d/nginx/run index 702917bfa..3a765dd46 100644 --- a/spotweb/rootfs/etc/services.d/nginx/run +++ b/spotweb/rootfs/etc/services.d/nginx/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # ============================================================================== # Home Assistant Community Add-on: spotweb # Runs the Nginx daemon diff --git a/spotweb/rootfs/etc/services.d/phpfpm/run b/spotweb/rootfs/etc/services.d/phpfpm/run index 8b90261e6..389892574 100644 --- a/spotweb/rootfs/etc/services.d/phpfpm/run +++ b/spotweb/rootfs/etc/services.d/phpfpm/run @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash bashio::log.info "Starting PHP-FPM..." diff --git a/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh b/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh index a6e1c6260..a23c18d18 100644 --- a/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh +++ b/webtop_kde/rootfs/etc/cont-init.d/00-data_location.sh @@ -1,4 +1,5 @@ #!/usr/bin/with-contenv bashio +# shellcheck shell=bash # Define user PUID=$(bashio::config "PUID") @@ -27,5 +28,5 @@ echo "Creating $LOCATION" mkdir -p "$LOCATION" # Set ownership -bashio::log.info "Setting ownership to $PUID:$PGID" +bashio::log.info "Setting ownership to $PUID:$PGID" chown "$PUID":"$PGID" "$LOCATION" diff --git a/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh b/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh index d1d61f4a0..1d522f93d 100644 --- a/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh +++ b/webtop_kde/rootfs/etc/cont-init.d/80-configuration.sh @@ -1,5 +1,6 @@ #!/usr/bin/with-contenv bashio # shellcheck shell=bash +# shellcheck disable=SC2116 # Add Edge repositories if bashio::config.true 'edge_repositories'; then @@ -12,7 +13,7 @@ fi # Install rpi video drivers if bashio::config.true 'rpi_video_drivers'; then bashio::log.info "Installing Rpi graphic drivers" - apk add --no-cache mesa-dri-vc4 mesa-dri-swrast mesa-gbm xf86-video-fbdev >/dev/null && bashio::log.green "... done" || + apk add --no-cache mesa-dri-vc4 mesa-dri-swrast mesa-gbm xf86-video-fbdev >/dev/null && bashio::log.green "... done" || bashio::log.red "... not successful. Are you on a rpi?" fi