Cleaner sed code

https://github.com/alexbelgium/hassio-addons/issues/755
This commit is contained in:
Alexandre
2023-03-13 15:41:00 +01:00
committed by GitHub
parent 2428ed6d87
commit 7a113412ed

View File

@@ -15,7 +15,7 @@ if [ ! -f "$CONFIG_LOCATION"/qBittorrent.conf ]; then
fi fi
cd "$CONFIG_LOCATION"/ || true cd "$CONFIG_LOCATION"/ || true
LINE=$(sed -n '/Preferences/=' qBittorrent.conf) || bashio::exit.nok "qBittorrent.conf not valid" LINE=$(sed -n '/\[Preferences\]/=' qBittorrent.conf) || bashio::exit.nok "qBittorrent.conf not valid"
LINE=$((LINE + 1)) LINE=$((LINE + 1))
# Remove unused folders # Remove unused folders
@@ -61,16 +61,16 @@ chown -R abc:abc "$DOWNLOADS" || bashio::log.fatal "Error, please check default
# Avoid bugs # # Avoid bugs #
############## ##############
sed -i '/CSRFProtection/d' qBittorrent.conf sed -i -e '/CSRFProtection/d' \
sed -i '/ClickjackingProtection/d' qBittorrent.conf -e '/ClickjackingProtection/d' \
sed -i '/HostHeaderValidation/d' qBittorrent.conf -e '/HostHeaderValidation/d' \
sed -i '/WebUI\Address/d' qBittorrent.conf -e '/WebUI\Address/d' \
#sed -i '/WebUI\ReverseProxySupportEnabled/d' qBittorrent.conf #sed -i '/WebUI\ReverseProxySupportEnabled/d' qBittorrent.conf
sed -i "$LINE i\WebUI\\\CSRFProtection=false" qBittorrent.conf -e "$LINE i\WebUI\\\CSRFProtection=false" \
sed -i "$LINE i\WebUI\\\ClickjackingProtection=false" qBittorrent.conf -e "$LINE i\WebUI\\\ClickjackingProtection=false" \
#sed -i "$LINE i\WebUI\\\ReverseProxySupportEnabled=true" qBittorrent.conf #sed -i "$LINE i\WebUI\\\ReverseProxySupportEnabled=true" qBittorrent.conf
sed -i "$LINE i\WebUI\\\HostHeaderValidation=false" qBittorrent.conf -e "$LINE i\WebUI\\\HostHeaderValidation=false" \
sed -i "$LINE i\WebUI\\\Address=*" qBittorrent.conf -e "$LINE i\WebUI\\\Address=*" qBittorrent.conf
################ ################
# Correct Port # # Correct Port #