-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·118 lines (96 loc) · 3.25 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·118 lines (96 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash
if [[ "${WEBUI_SSL}" = "y" ]]; then
export QBT_INSECURE=y
export QBT_SCHEME=https
fi
function configure_qbt {
QBT_HOST="${QBT_HOST:-localhost}"
QBT_PORT="${QBT_PORT:-80}"
QBT_USERNAME="${QBT_USERNAME:-admin}"
# WEBUI_SSL=y enables SSL on WEB_UI and --insecure on kiwix-seeder
if [[ "${WEBUI_SSL}" = "y" ]]; then
websslvalue="true"
webuischeme="https"
else
webuischeme="http"
websslvalue="false"
fi
# configure qbittorrent-cli (qbt)
if [[ "${WEBUI_SSL}" = "y" ]]; then
qbt network settings --ignore-certificate-errors TRUE
fi
qbt settings set url "${webuischeme}://${QBT_HOST}:${QBT_PORT}/"
qbt settings set username "${QBT_USERNAME}"
echo "${QBT_PASSWORD}" | qbt settings set password -y
QBT_CONFIG_FILE=/root/.config/qBittorrent/qBittorrent.conf
if [ -f "$QBT_CONFIG_FILE" ] ; then
echo "Found existing qBittorrent config file at $QBT_CONFIG_FILE"
echo "Assuming persistent installation ; skipping configuration."
return
fi
QBT_TORRENTING_PORT="${QBT_TORRENTING_PORT:-6901}"
QBT_MAX_CONNECTIONS="${QBT_MAX_CONNECTIONS:-500}"
QBT_MAX_CONNECTIONS_PER_TORRENT="${QBT_MAX_CONNECTIONS_PER_TORRENT:-100}"
QBT_MAX_UPLOADS="${QBT_MAX_UPLOADS:-20}"
QBT_MAX_UPLOADS_PER_TORRENT="${QBT_MAX_UPLOADS_PER_TORRENT:-5}"
QBT_MAX_ACTIVE_CHECKING_TORRENTS="${QBT_MAX_ACTIVE_CHECKING_TORRENTS:-1}"
if [ "x${QBT_PASSWORD}" = "x" ]; then
QBT_PASSWORD=$(gen-password)
echo "Generated web-ui password: ${QBT_PASSWORD}"
fi
PKBF2_PASSWORD=$(get-pbkdf2 "${QBT_PASSWORD}")
mkdir -p $(dirname $QBT_CONFIG_FILE)
cat <<EOF > $QBT_CONFIG_FILE
[BitTorrent]
MergeTrackersEnabled=true
Session\DefaultSavePath=/data/files
Session\AddExtensionToIncompleteFiles=true
Session\MaxConnections=${QBT_MAX_CONNECTIONS}
Session\MaxConnectionsPerTorrent=${QBT_MAX_CONNECTIONS_PER_TORRENT}
Session\MaxUploads=${QBT_MAX_UPLOADS}
Session\MaxUploadsPerTorrent=${QBT_MAX_UPLOADS_PER_TORRENT}
Session\Port=${QBT_TORRENTING_PORT}
Session\Preallocation=true
Session\QueueingSystemEnabled=false
Session\SSL\Port=30154
Session\MaxActiveCheckingTorrents=${QBT_MAX_ACTIVE_CHECKING_TORRENTS}
[LegalNotice]
Accepted=true
[Meta]
MigrationVersion=8
[Preferences]
General\Locale=en
WebUI\Enabled=true
WebUI\HTTPS\Enabled=${websslvalue}
WebUI\HTTPS\CertificatePath=${WEBUI_SSL_CERT}
WebUI\HTTPS\KeyPath=${WEBUI_SSL_KEY}
WebUI\Address=${WEBUI_ADDRESS}
WebUI\Port=${QBT_PORT}
WebUI\Username=${QBT_USERNAME}
WebUI\Password_PBKDF2="@ByteArray(${PKBF2_PASSWORD})"
WebUI\LocalHostAuth=true
WebUI\HostHeaderValidation=false
WebUI\CSRFProtection=false
[Core]
AutoDeleteAddedTorrentFile=Always
[Application]
FileLogger\Age=5
FileLogger\AgeType=0
FileLogger\Backup=true
FileLogger\DeleteOld=true
FileLogger\Enabled=true
FileLogger\MaxSizeBytes=1048576
FileLogger\Path=/data/log
GUI\Notifications\TorrentAdded=false
EOF
}
if [ "x${NO_QBT}" = "x" ]; then
configure_qbt
echo "Starting a qbittorrent-nox process (set NO_QBT if you dont want to)"
/usr/bin/qbittorrent-nox --daemon
# give a few seconds to qBittorrent to start before staring the loop
# as the loop has no fancy retry mechanism ATM and will wait sleep_interval (long)
# before re-trying
sleep 3
fi
exec "$@"