From c5fd05ddcd7d271f0c9b0b3436474ecf77173bf5 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 10 Feb 2021 11:18:13 +0100 Subject: [PATCH] update template --- .../rootfs/etc/cont-init.d/91-configuration | 25 ----- .../etc/cont-init.d/91-configuration.sh | 88 ++++++++++++++++++ .../etc/cont-init.d/{51-mounts => 92-mounts} | 9 +- .../rootfs/etc/cont-init.d/93-test.lnk | Bin 0 -> 1269 bytes 4 files changed, 96 insertions(+), 26 deletions(-) delete mode 100644 .template/rootfs/etc/cont-init.d/91-configuration create mode 100644 .template/rootfs/etc/cont-init.d/91-configuration.sh rename .template/rootfs/etc/cont-init.d/{51-mounts => 92-mounts} (87%) create mode 100644 qbittorrent/rootfs/etc/cont-init.d/93-test.lnk diff --git a/.template/rootfs/etc/cont-init.d/91-configuration b/.template/rootfs/etc/cont-init.d/91-configuration deleted file mode 100644 index 94200aa6e..000000000 --- a/.template/rootfs/etc/cont-init.d/91-configuration +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/with-contenv bashio - -#clean HTTPS data -sed -i '/HTTPS/d' /config/qBittorrent/qBittorrent.conf - -bashio::config.require.ssl -if bashio::config.true 'ssl'; then - bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" - #set variables - CERTFILE=$(bashio::config 'certfile') - KEYFILE=$(bashio::config 'keyfile') - #Check if certificates exist - #if [ bashio::fs.file_exists "/ssl/$CERTFILE" ] && [ bashio::fs.file_exists "/ssl/$KEYFILE" ]; then - cd /config/qBittorrent - LINE=$(sed -n '/Preferences/=' qBittorrent.conf) - LINE=$[LINE + 1] - sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf - sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf - sed -i "$LINE i\WebUI\\\HTTPS\\\KeyPath=/ssl/$KEYFILE" qBittorrent.conf - #else bashio::log.error "Certificates not found in $CERTFILE and/or $KEYFILE" - #fi -fi - -bashio::log.info "Default username/password : admin/adminadmin" -bashio::log.info "Configuration can be found in /config/qBittorrent" diff --git a/.template/rootfs/etc/cont-init.d/91-configuration.sh b/.template/rootfs/etc/cont-init.d/91-configuration.sh new file mode 100644 index 000000000..8b068f259 --- /dev/null +++ b/.template/rootfs/etc/cont-init.d/91-configuration.sh @@ -0,0 +1,88 @@ +#!/usr/bin/with-contenv bashio + +########## +# INIT # +########## + +# Define preferences line +cd /config/qBittorrent/ +LINE=$(sed -n '/Preferences/=' qBittorrent.conf) +LINE=$((LINE + 1)) + +################ +# SSL CONFIG # +################ + +# Clean data +sed -i '/HTTPS/d' qBittorrent.conf + +bashio::config.require.ssl +if bashio::config.true 'ssl'; then + bashio::log.info "ssl enabled. If webui don't work, disable ssl or check your certificate paths" + #set variables + CERTFILE=$(bashio::config 'certfile') + KEYFILE=$(bashio::config 'keyfile') + sed -i "$LINE i\WebUI\\\HTTPS\\\Enabled=True" qBittorrent.conf + sed -i "$LINE i\WebUI\\\HTTPS\\\CertificatePath=/ssl/$CERTFILE" qBittorrent.conf + sed -i "$LINE i\WebUI\\\HTTPS\\\KeyPath=/ssl/$KEYFILE" qBittorrent.conf +fi + +################ +# WHITELIST # +################ + +cd /config/qBittorrent/ +if bashio::config.has_value 'whitelist'; then + WHITELIST=$(bashio::config 'whitelist') + #clean data + sed -i '/AuthSubnetWhitelist/d' qBittorrent.conf + sed -i "$LINE i\WebUI\\\AuthSubnetWhitelistEnabled=true" qBittorrent.conf + sed -i "$LINE i\WebUI\\\AuthSubnetWhitelist=$WHITELIST" qBittorrent.conf + bashio::log.info "Whitelisted subsets will not require a password : $WHITELIST" +fi + +################ +# Alternate UI # +################ + +#clean data +sed -i '/AlternativeUIEnabled/d' qBittorrent.conf +rm -f -r /data/webui +mkdir -p /data/webui + +if bashio::config.has_value 'customUI'; then + ### Variables + CUSTOMUI=$(bashio::config 'customUI') + bashio::log.info "Alternate UI enabled : $CUSTOMUI. If webui don't work, disable this option" + + ### Download WebUI + case $CUSTOMUI in + "vuetorrent") + curl -s -S -J -L -o /data/webui/release.zip $(curl -s https://api.github.com/repos/WDaan/VueTorrent/releases/latest | grep -o "http.*release.zip") >/dev/null + ;; + + "qbit-matUI") + curl -J -L -o /data/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 -J -L -o /data/webui/release.zip $(curl -s https://api.github.com/repos/CzBiX/qb-web/releases/latest | grep -o "http.*.zip") >/dev/null + ;; + esac + + ### Install WebUI + mkdir -p /data/webui/$CUSTOMUI + unzip -u -q /data/webui/release.zip -d /data/webui/$CUSTOMUI + rm /data/webui/*.zip + CUSTOMUIDIR=$(find /data/webui/$CUSTOMUI -iname "public" -type d) + CUSTOMUIDIR="$(dirname "$CUSTOMUIDIR")" + sed -i "$LINE i\WebUI\\\AlternativeUIEnabled=true" /config/qBittorrent/qBittorrent.conf + sed -i "$LINE i\WebUI\\\RootFolder=$CUSTOMUIDIR" /config/qBittorrent/qBittorrent.conf +fi + +########## +# CLOSE # +########## + +bashio::log.info "Default username/password : admin/adminadmin" +bashio::log.info "Configuration can be found in /config/qBittorrent" diff --git a/.template/rootfs/etc/cont-init.d/51-mounts b/.template/rootfs/etc/cont-init.d/92-mounts similarity index 87% rename from .template/rootfs/etc/cont-init.d/51-mounts rename to .template/rootfs/etc/cont-init.d/92-mounts index e7fb49d35..b8cb2b720 100644 --- a/.template/rootfs/etc/cont-init.d/51-mounts +++ b/.template/rootfs/etc/cont-init.d/92-mounts @@ -1,8 +1,11 @@ #!/usr/bin/with-contenv bashio -bashio::log.info 'Mounting external hdd...' +###################### +# MOUNT LOCAL SHARES # +###################### # Mount local Share if configured and if Protection Mode is active if bashio::config.has_value 'localdisks'; then + bashio::log.info 'Mounting external hdd...' MOREDISKS=$(bashio::config 'localdisks') bashio::log.info "Local Disks mounting.. ${MOREDISKS}" && \ for disk in $MOREDISKS @@ -20,8 +23,12 @@ if bashio::config.has_value 'localdisks'; then bashio::log.warning "Protection mode is ON. Unable to mount local drives!" fi +#################### +# MOUNT SMB SHARES # +#################### # Mount CIFS Share if configured and if Protection Mode is active if bashio::config.has_value 'networkdisks'; then + bashio::log.info 'Mounting smb share...' MOREDISKS=$(bashio::config 'networkdisks') CIFS_USERNAME=$(bashio::config 'cifsusername') CIFS_PASSWORD=$(bashio::config 'cifspassword') diff --git a/qbittorrent/rootfs/etc/cont-init.d/93-test.lnk b/qbittorrent/rootfs/etc/cont-init.d/93-test.lnk new file mode 100644 index 0000000000000000000000000000000000000000..9b3702695309f37c2a1b4e551cbde6935e3898e2 GIT binary patch literal 1269 zcmah|Ur1A76#uQHvZr)AG`ij;z*)6v#+f_%TW%N+c zA0i^KBC%Q#2?`+<6hZV*Pd$abMS(;Sz4_8ZowK{?45f29fA05v_jk_yo%6W?7z$UA z1zx8uT5cg96%@alcF*1T^U;v?$%%$pejiz_A2jH0-u_%sh|S*5o(~n@ZHjSxCLcS^ z<~yaRwA;k|p@pCWRp}SIyvb{XKOF4?Y$!k;e!aTsoj%0t5}lYV&m+5X;lp&Kl&v%P z5k?gB84BUgpjFGMq!F!(=IlQX)MxNcb$0ji4&zz(as8EPlm!#luA&tRG&s=@`V>V7 zWiVZ`f4>pVMxU?EGfYLhGpIwItFG}LqrP`DR)!f4)AIIfsUd;@67(ogVWK!hkBS(r z03{Ha98P&|53$hP?sYeE4o4;jud{NFsYwRC&L&6Boo#|db?aR8QU;D0JIjfV9amMY zhmvMF$wf9lXF%IO9UbUyLY!(<39%<#ZxLLJ>J4i_SeK}@>jmR&XOkn07bdJAt!*HV z_5SPC**zV8Q`>Nr?^bfkgMm`#niRmgJ(C1M!ZNZeY$!|IZ^ z$rY%znA$yEx!k(s8kv>3ygrw0{Z$JwRy;XwP6+tzo znUt8KNg+Xh5LNqQ8db2Ceo`z^S{>|ki3GJ?9|y5$s0EfEMzO>YiAC)fndXUQC_kqE z^w>f2EO8|{7_^upX3H+?ZhCKd{PM)syEezulr(*KZ}CiG!d`Rn;eh`8NCe zfBVgZQ2>n9lCSc4eN#nI$He76=R;?MbiXcnshrj$q%=RknUUIiJJyVQQlC<#ql4#1 Ic|9wC0a;%NIRF3v literal 0 HcmV?d00001