From b8bdda6335edae16326ba6c21e4a6d75b563034f Mon Sep 17 00:00:00 2001
From: gilbN <24592972+gilbN@users.noreply.github.com>
Date: Sun, 28 Feb 2021 19:07:13 +0100
Subject: [PATCH] some if rules
---
qbittorrent/root/etc/cont-init.d/98-themepark | 61 +++++++++++--------
1 file changed, 37 insertions(+), 24 deletions(-)
diff --git a/qbittorrent/root/etc/cont-init.d/98-themepark b/qbittorrent/root/etc/cont-init.d/98-themepark
index 292a9cc3..64fb675e 100644
--- a/qbittorrent/root/etc/cont-init.d/98-themepark
+++ b/qbittorrent/root/etc/cont-init.d/98-themepark
@@ -1,7 +1,7 @@
#!/usr/bin/with-contenv bash
echo '------------------------------'
-echo '| qBittorrent theme.park Mod |'
+echo '| qBittorrent theme.park Mod |'
echo '------------------------------'
# Display variables for troubleshooting
@@ -21,36 +21,49 @@ if [[ -z ${TP_THEME} ]]; then
fi
# Copying template
-if [[ ! -d /theme ]]; then
- echo '--------------------------'
- echo '| Copying the template |'
- echo '--------------------------'
- cp -r /defaults/theme /theme
- printf 'Template copied to "/theme"\n'
+if [[ ! -d /themepark ]]; then
+ echo '------------------------'
+ echo '| Copying the template |'
+ echo '------------------------'
+ cp -r /defaults/theme /themepark
+ printf 'Template copied to "/themepark"\n'
fi
# Adding stylesheets
-if ! grep -q "${TP_DOMAIN}" /theme/public/index.html; then
- echo '-------------------------------------------------'
- echo '| Adding the stylesheet to public index.html |'
- echo '-------------------------------------------------'
- sed -i "s/<\/head>/<\/head> /g" /theme/public/index.html
+if ! grep -q "${TP_DOMAIN}" /themepark/public/index.html; then
+ echo '----------------------------------------------'
+ echo '| Adding the stylesheet to public index.html |'
+ echo '----------------------------------------------'
+ sed -i "s/<\/head>/<\/head> /g" /themepark/public/index.html
printf 'Stylesheet set to %s on public index.html\n' "${TP_THEME}"
fi
-if ! grep -q "${TP_DOMAIN}" /theme/private/index.html; then
- echo '-------------------------------------------------'
- echo '| Adding the stylesheet to private index.html |'
- echo '-------------------------------------------------'
- sed -i "s/<\/head>/<\/head> /g" /theme/private/index.html
+if ! grep -q "${TP_DOMAIN}" /themepark/private/index.html; then
+ echo '-----------------------------------------------'
+ echo '| Adding the stylesheet to private index.html |'
+ echo '-----------------------------------------------'
+ sed -i "s/<\/head>/<\/head> /g" /themepark/private/index.html
printf 'Stylesheet set to %s\n private index.html' "${TP_THEME}"
fi
-if ! grep -q "WebUI\\\RootFolder=/theme" /config/qBittorrent/qBittorrent.conf; then
- echo '---------------------------------------------'
- echo '| Enabling alternate WebUI in qBittorrent |'
- echo '---------------------------------------------'
- sed -i "s/WebUI\\AlternativeUIEnabled=.*$/WebUI\AlternativeUIEnabled=true/g" /config/qBittorrent/qBittorrent.conf
- sed -i "s/WebUI\\RootFolder=.*$/WebUI\RootFolder=\/theme/g" /config/qBittorrent/qBittorrent.conf
- printf 'Enabled aternate WebUI in qBittorrent.conf'
+if ! grep -q "WebUI\\\RootFolder" /config/qBittorrent/qBittorrent.conf; then
+ echo '--------------------------------------'
+ echo '| Adding WebUI\RootFolder=/themepark |'
+ echo '--------------------------------------'
+ sed -i -e '$aWebUI\\RootFolder=/themepark' /config/qBittorrent/qBittorrent.conf;
+fi
+
+if ! grep -q "WebUI\\\AlternativeUIEnabled" /config/qBittorrent/qBittorrent.conf; then
+ echo '------------------------------------------'
+ echo '| Adding WebUI\AlternativeUIEnabled=true |'
+ echo '------------------------------------------'
+ sed -i -e '$aWebUI\\AlternativeUIEnabled=true' /config/qBittorrent/qBittorrent.conf;
+fi
+
+if ! grep -q "WebUI\\\RootFolder=/themepark" /config/qBittorrent/qBittorrent.conf || ! grep -q "WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf; then
+ echo '-------------------------------------------------------'
+ echo '| Updating RootFolder and AlternativeUIEnabled values |'
+ echo '-------------------------------------------------------'
+ sed -i "s/WebUI\\\AlternativeUIEnabled=.*$/WebUI\\\AlternativeUIEnabled=true/g" /config/qBittorrent/qBittorrent.conf;
+ sed -i "s/WebUI\\\RootFolder=.*$/WebUI\\\RootFolder=\/themepark/g" /config/qBittorrent/qBittorrent.conf;
fi
\ No newline at end of file