mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Improve Docker build
* Improves code readability. * Improve documentation. * Fix "docker stop" doesn't terminate qbt gracefully which could lead to data corruption. * Provide correct/working bittorrent listening port by default. * Make use of qbt profile option instead of hacking environment variables. * Simplify build steps. PR #16976.
This commit is contained in:
parent
fb7f7d0c75
commit
4894578b72
3 changed files with 110 additions and 86 deletions
21
dist/docker/entrypoint.sh
vendored
21
dist/docker/entrypoint.sh
vendored
|
@ -1,21 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ ! -f /config/qBittorrent/qBittorrent.conf ]; then
|
||||
mkdir -p /config/qBittorrent/
|
||||
cat << EOF > /config/qBittorrent/qBittorrent.conf
|
||||
profilePath="/config"
|
||||
qbtConfigFile="$profilePath/qBittorrent/config/qBittorrent.conf"
|
||||
|
||||
if [ ! -f "$qbtConfigFile" ]; then
|
||||
mkdir -p "$(dirname $qbtConfigFile)"
|
||||
cat << EOF > "$qbtConfigFile"
|
||||
[BitTorrent]
|
||||
Session\DefaultSavePath=/downloads
|
||||
Session\Port=6881
|
||||
Session\TempPath=/downloads/temp
|
||||
|
||||
[LegalNotice]
|
||||
Accepted=false
|
||||
EOF
|
||||
|
||||
if [ "$LEGAL" = "accept" ] ; then
|
||||
sed -i '/^\[LegalNotice\]$/{$!{N;s|\(\[LegalNotice\]\nAccepted=\).*|\1true|}}' /config/qBittorrent/qBittorrent.conf
|
||||
if [ "$QBT_EULA" = "accept" ]; then
|
||||
sed -i '/^\[LegalNotice\]$/{$!{N;s|\(\[LegalNotice\]\nAccepted=\).*|\1true|}}' "$qbtConfigFile"
|
||||
else
|
||||
sed -i '/^\[LegalNotice\]$/{$!{N;s|\(\[LegalNotice\]\nAccepted=\).*|\1false|}}' /config/qBittorrent/qBittorrent.conf
|
||||
sed -i '/^\[LegalNotice\]$/{$!{N;s|\(\[LegalNotice\]\nAccepted=\).*|\1false|}}' "$qbtConfigFile"
|
||||
fi
|
||||
fi
|
||||
|
||||
HOME="/config" XDG_CONFIG_HOME="/config" XDG_DATA_HOME="/data" qbittorrent-nox --webui-port=$WEBUI_PORT
|
||||
qbittorrent-nox \
|
||||
--profile="$profilePath" \
|
||||
--webui-port="$QBT_WEBUI_PORT" \
|
||||
"$@"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue