mirror of
https://github.com/qbittorrent/docker-qbittorrent-nox.git
synced 2024-11-26 19:00:33 +00:00
Check directory existence before performing operations on it
This is to support the use case where user has their own download directory and don't use the hardcoded `/downloads` path. Fixes #20.
This commit is contained in:
parent
6763310101
commit
1d964be6e6
@ -28,9 +28,9 @@ if [ ! -f "$qbtConfigFile" ]; then
|
||||
mkdir -p "$(dirname $qbtConfigFile)"
|
||||
cat << EOF > "$qbtConfigFile"
|
||||
[BitTorrent]
|
||||
Session\DefaultSavePath=/downloads
|
||||
Session\DefaultSavePath=$downloadsPath
|
||||
Session\Port=6881
|
||||
Session\TempPath=/downloads/temp
|
||||
Session\TempPath=$downloadsPath/temp
|
||||
|
||||
[LegalNotice]
|
||||
Accepted=false
|
||||
@ -57,8 +57,12 @@ fi
|
||||
|
||||
# those are owned by root by default
|
||||
# don't change existing files owner in `$downloadsPath`
|
||||
chown qbtUser:qbtUser "$downloadsPath"
|
||||
chown qbtUser:qbtUser -R "$profilePath"
|
||||
if [ -d "$downloadsPath" ]; then
|
||||
chown qbtUser:qbtUser "$downloadsPath"
|
||||
fi
|
||||
if [ -d "$profilePath" ]; then
|
||||
chown qbtUser:qbtUser -R "$profilePath"
|
||||
fi
|
||||
|
||||
# set umask just before starting qbt
|
||||
if [ -n "$UMASK" ]; then
|
||||
|
@ -28,9 +28,9 @@ if [ ! -f "$qbtConfigFile" ]; then
|
||||
mkdir -p "$(dirname $qbtConfigFile)"
|
||||
cat << EOF > "$qbtConfigFile"
|
||||
[BitTorrent]
|
||||
Session\DefaultSavePath=/downloads
|
||||
Session\DefaultSavePath=$downloadsPath
|
||||
Session\Port=6881
|
||||
Session\TempPath=/downloads/temp
|
||||
Session\TempPath=$downloadsPath/temp
|
||||
|
||||
[LegalNotice]
|
||||
Accepted=false
|
||||
@ -57,8 +57,12 @@ fi
|
||||
|
||||
# those are owned by root by default
|
||||
# don't change existing files owner in `$downloadsPath`
|
||||
chown qbtUser:qbtUser "$downloadsPath"
|
||||
chown qbtUser:qbtUser -R "$profilePath"
|
||||
if [ -d "$downloadsPath" ]; then
|
||||
chown qbtUser:qbtUser "$downloadsPath"
|
||||
fi
|
||||
if [ -d "$profilePath" ]; then
|
||||
chown qbtUser:qbtUser -R "$profilePath"
|
||||
fi
|
||||
|
||||
# set umask just before starting qbt
|
||||
if [ -n "$UMASK" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user