Skip to content

Commit 4324e59

Browse files
committed
qbittorrent:fix umask setting for 4.3.9
1 parent de9217e commit 4324e59

File tree

3 files changed

+91
-7
lines changed

3 files changed

+91
-7
lines changed

qbittorrent/Dockerfile.4.3.9

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
ARG LIBTORRENT_VERSION=1
2+
FROM nevinee/libtorrent-rasterbar:${LIBTORRENT_VERSION} AS builder
3+
RUN apk upgrade \
4+
&& apk add --no-cache \
5+
boost-dev \
6+
openssl-dev \
7+
qt5-qtbase-dev \
8+
qt5-qttools-dev \
9+
g++ \
10+
cmake \
11+
curl \
12+
tar \
13+
samurai \
14+
&& rm -rf /tmp/* /var/cache/apk/*
15+
ARG QBITTORRENT_VERSION
16+
RUN mkdir -p /tmp/qbittorrent \
17+
&& cd /tmp/qbittorrent \
18+
&& curl -sSL https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-${QBITTORRENT_VERSION}.tar.gz | tar xz --strip-components 1 \
19+
&& cmake \
20+
-DCMAKE_BUILD_TYPE=Release \
21+
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
22+
-DCMAKE_CXX_STANDARD=17 \
23+
-DWEBUI=ON \
24+
-DVERBOSE_CONFIGURE=OFF \
25+
-DSTACKTRACE=OFF \
26+
-DDBUS=OFF \
27+
-DGUI=OFF \
28+
-DQT6=OFF \
29+
-Brelease \
30+
-GNinja \
31+
&& cmake --build release -j $(nproc) \
32+
&& cmake --install release \
33+
&& ls -al /usr/local/bin/ \
34+
&& qbittorrent-nox --help
35+
RUN echo "Copy to /out" \
36+
&& strip /usr/local/lib/libtorrent-rasterbar.so.* \
37+
&& strip /usr/local/bin/qbittorrent-nox \
38+
&& mkdir -p /out/usr/lib /out/usr/bin \
39+
&& cp -d /usr/local/lib/libtorrent-rasterbar.so* /out/usr/lib \
40+
&& cp /usr/local/bin/qbittorrent-nox /out/usr/bin
41+
42+
FROM alpine:latest AS app
43+
ENV QBT_PROFILE=/home/qbittorrent \
44+
TZ=Asia/Shanghai \
45+
PUID=1000 \
46+
PGID=100 \
47+
WEBUI_PORT=8080 \
48+
BT_PORT=34567 \
49+
QB_USERNAME=admin \
50+
QB_PASSWORD=adminadmin \
51+
LANG=zh_CN.UTF-8 \
52+
SHELL=/bin/bash \
53+
PS1="\u@\h:\w \$ "
54+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.bfsu.edu.cn/g' /etc/apk/repositories \
55+
&& apk add --no-cache \
56+
bash \
57+
busybox-suid \
58+
curl \
59+
jq \
60+
openssl \
61+
python3 \
62+
qt5-qtbase \
63+
shadow \
64+
su-exec \
65+
tini \
66+
tzdata \
67+
&& rm -rf /tmp/* /var/cache/apk/* \
68+
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
69+
&& echo "${TZ}" > /etc/timezone \
70+
&& useradd qbittorrent -u ${PUID} -U -m -d ${QBT_PROFILE} -s /sbin/nologin
71+
COPY --from=builder /out /
72+
COPY root /
73+
WORKDIR /data
74+
VOLUME ["/data"]
75+
ENTRYPOINT ["tini", "-g", "--", "entrypoint.sh"]

qbittorrent/root/etc/entrypoint.d/30-config.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ QB_PASSWD_HASH=$(gen-qb-passwd "$QB_PASSWORD")
33
BT_PORT=${BT_PORT:-34567}
44
WEBUI_PORT=${WEBUI_PORT:-8080}
55

6+
major_ver=$(qbittorrent-nox --version | sed 's|qBittorrent v||' | awk -F. '{print $1}')
7+
minor_ver=$(qbittorrent-nox --version | sed 's|qBittorrent v||' | awk -F. '{print $2}')
8+
9+
if [[ $major_ver -eq 4 && $minor_ver -lt 5 ]]; then
10+
PAM="%I"
11+
else
12+
PAM="%K"
13+
fi
14+
615
if [ ! -s $QB_CONF_FILE ]; then
716
echo "Initializing qBittorrent configuration..."
817
cat > $QB_CONF_FILE << EOF
918
[AutoRun]
1019
enabled=true
11-
program=dl-finish \"%K\"
20+
program=dl-finish \"$PAM\"
1221
1322
[BitTorrent]
1423
Session\DefaultSavePath=/data/downloads
@@ -43,11 +52,8 @@ else
4352
}" $QB_CONF_FILE
4453
fi
4554

46-
major_ver=$(qbittorrent-nox --version | sed 's|qBittorrent v||' | awk -F. '{print $1}')
47-
minor_ver=$(qbittorrent-nox --version | sed 's|qBittorrent v||' | awk -F. '{print $2}')
48-
49-
if [[ $major_ver -eq 4 && $minor_ver -ge 5 ]]; then
50-
sed -i -E 's|General\\Locale=.+|General\\Locale=zh_CN|' $QB_CONF_FILE
51-
elif [[ $major_ver -eq 4 && $minor_ver -lt 5 ]]; then
55+
if [[ $major_ver -eq 4 && $minor_ver -lt 5 ]]; then
5256
sed -i -E 's|General\\Locale=.+|General\\Locale=zh|' $QB_CONF_FILE
57+
else
58+
sed -i -E 's|General\\Locale=.+|General\\Locale=zh_CN|' $QB_CONF_FILE
5359
fi

qbittorrent/root/usr/local/bin/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ fi
1111
crond
1212

1313
echo "Start qbittorrent-nox..."
14+
if [[ -n ${UMASK_SET} ]]; then
15+
umask ${UMASK_SET}
16+
fi
1417
exec su-exec "${PUID}:${PGID}" qbittorrent-nox

0 commit comments

Comments
 (0)