From 0b86e82765be554775ea1e8e6e07e01a42e93f2e Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 18 Feb 2022 13:55:23 +0100 Subject: [PATCH] lint --- portainer/rootfs/etc/cont-init.d/30-nginx.sh | 2 +- .../rootfs/etc/cont-init.d/30-nginx.sh | 4 ++-- .../91-qbittorrent_configuration.sh | 23 ++++++++++--------- .../rootfs/etc/cont-init.d/93-openvpn.sh | 4 ++-- qbittorrent/rootfs/etc/openvpn/down.sh | 1 + qbittorrent/rootfs/etc/openvpn/up.sh | 1 + 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/portainer/rootfs/etc/cont-init.d/30-nginx.sh b/portainer/rootfs/etc/cont-init.d/30-nginx.sh index b095747de..c5f479d72 100644 --- a/portainer/rootfs/etc/cont-init.d/30-nginx.sh +++ b/portainer/rootfs/etc/cont-init.d/30-nginx.sh @@ -5,7 +5,7 @@ # NGINX SETTING # ################# -declare admin_port +#declare admin_port declare portainer_protocol=http # Generate Ingress configuration diff --git a/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh b/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh index 406ed9447..ab2f07f8c 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/30-nginx.sh @@ -5,7 +5,7 @@ # NGINX SETTING # ################# -declare admin_port +#declare admin_port declare qbittorrent_protocol=http # Generate Ingress configuration @@ -31,6 +31,6 @@ LATEST_RELEASE=$(curl -s -L https://api.github.com/repos/wdaan/vuetorrent/releas tr -d \" | xargs) -curl -s -S -O -J -L $LATEST_RELEASE +curl -s -S -O -J -L "$LATEST_RELEASE" unzip -o vuetorrent.zip -d / >/dev/null rm /vuetorrent.zip >/dev/null diff --git a/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh b/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh index edd2de04f..ed3b3036a 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/91-qbittorrent_configuration.sh @@ -6,7 +6,8 @@ ########## # Define preferences line -cd /config/qBittorrent/ +mkdir -p /config/qBittorrent +cd /config/qBittorrent/ || true LINE=$(sed -n '/Preferences/=' qBittorrent.conf) LINE=$((LINE + 1)) @@ -32,8 +33,8 @@ if bashio::config.has_value 'SavePath'; then #sed -i "$LINE i\Session\\\DefaultSavePath=$DOWNLOADS" qBittorrent.conf sed -i '/SavePath/d' qBittorrent.conf sed -i "$LINE i\Downloads\\\SavePath=$DOWNLOADS" qBittorrent.conf - mkdir -p $DOWNLOADS || bashio::log.fatal "Error : folder defined in SavePath doesn't exist and can't be created. Check path" - chown -R abc:abc $DOWNLOADS || bashio::log.fatal "Error, please check default save folder configuration in addon" + mkdir -p "$DOWNLOADS" || bashio::log.fatal "Error : folder defined in SavePath doesn't exist and can't be created. Check path" + chown -R abc:abc "$DOWNLOADS" || bashio::log.fatal "Error, please check default save folder configuration in addon" bashio::log.info "Downloads can be found in $DOWNLOADS" else @@ -87,7 +88,7 @@ fi # WHITELIST # ################ -cd /config/qBittorrent/ +cd /config/qBittorrent/ || true if bashio::config.has_value 'whitelist'; then WHITELIST=$(bashio::config 'whitelist') #clean data @@ -101,7 +102,7 @@ fi # USERNAME # ############### -cd /config/qBittorrent/ +cd /config/qBittorrent/ || true if bashio::config.has_value 'Username'; then USERNAME=$(bashio::config 'Username') #clean data @@ -130,23 +131,23 @@ if bashio::config.has_value 'customUI'; then ### Download WebUI case $CUSTOMUI in "vuetorrent") - curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip") >/dev/null + curl -s -S -J -L -o /webui/release.zip "$(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*vuetorrent.zip")" >/dev/null ;; "qbit-matUI") - curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip") >/dev/null + curl -s -S -J -L -o /webui/release.zip "$(curl -s https://api.github.com/repos/bill-ahmed/qbit-matUI/releases/latest | grep -o "http.*Unix.*.zip")" >/dev/null ;; "qb-web") - curl -s -S -J -L -o /webui/release.zip $(curl -s https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip") >/dev/null + curl -s -S -J -L -o /webui/release.zip "$(curl -s https://api.github.com/repos/CzBiX/qb-web/releases | grep -o "http.*qb-web-.*zip")" >/dev/null ;; esac ### Install WebUI - mkdir -p /webui/$CUSTOMUI - unzip -q /webui/release.zip -d /webui/$CUSTOMUI + mkdir -p /webui/"$CUSTOMUI" + unzip -q /webui/release.zip -d /webui/"$CUSTOMUI" rm /webui/*.zip - CUSTOMUIDIR="$(dirname "$(find /webui/$CUSTOMUI -iname "public" -type d)")" + CUSTOMUIDIR="$(dirname "$(find /webui/"$CUSTOMUI" -iname "public" -type d)")" # Set qbittorrent sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf diff --git a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh index de89e982b..050a201c9 100644 --- a/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh +++ b/qbittorrent/rootfs/etc/cont-init.d/93-openvpn.sh @@ -40,7 +40,7 @@ if bashio::config.true 'openvpn_enabled'; then QBT_CONFIG_FILE="/config/qBittorrent/qBittorrent.conf" # Define preferences line - cd /config/qBittorrent/ + cd /config/qBittorrent/ || exit 1 LINE=$(sed -n '/Preferences/=' qBittorrent.conf) LINE=$((LINE + 1)) @@ -77,7 +77,7 @@ else # REMOVE OPENVPN # ################## # Ensure no redirection by removing the direction tag - cd /config/qBittorrent/ + cd /config/qBittorrent/ || exit 1 sed -i '/Interface/d' qBittorrent.conf bashio::log.info "Direct connection without VPN enabled" diff --git a/qbittorrent/rootfs/etc/openvpn/down.sh b/qbittorrent/rootfs/etc/openvpn/down.sh index 50d463f16..c83569cbe 100644 --- a/qbittorrent/rootfs/etc/openvpn/down.sh +++ b/qbittorrent/rootfs/etc/openvpn/down.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SD2154,SC2004,SC2059,SC2086 # Copyright (c) 2006-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Contributed by Roy Marples (uberlord@gentoo.org) diff --git a/qbittorrent/rootfs/etc/openvpn/up.sh b/qbittorrent/rootfs/etc/openvpn/up.sh index 82a9bae2c..8d369a2f1 100644 --- a/qbittorrent/rootfs/etc/openvpn/up.sh +++ b/qbittorrent/rootfs/etc/openvpn/up.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SD2154,SC2004,SC2059,SC2086 # launch qbittorrent /etc/openvpn/up-qbittorrent.sh "${4}" &