Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
29bb822f5c |
@ -22,7 +22,6 @@ RUN apt-get update && \
|
||||
|
||||
RUN curl -s -o "/tmp/libtorrent-${LIBTORRENT_VERSION}.tar.gz" -L "$LIBTORRENT_URL" && \
|
||||
FILE_HASH="$(sha256sum /tmp/libtorrent-${LIBTORRENT_VERSION}.tar.gz | cut -d' ' -f1)" && \
|
||||
echo hey; \
|
||||
du -sh "/tmp/libtorrent-${LIBTORRENT_VERSION}.tar.gz"; \
|
||||
if [ ! "$LIBTORRENT_HASH" = "$FILE_HASH" ]; then \
|
||||
echo "SHA256 verification failed!" && \
|
||||
@ -69,7 +68,9 @@ COPY --from=build /tmp/rtorrent.rc.template /tmp/rtorrent.rc.template
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
libcurl4 \
|
||||
libncursesw6 && \
|
||||
libncursesw6 \
|
||||
procps \
|
||||
screen && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -eux
|
||||
|
||||
# GID/UID
|
||||
USER_ID=${GUID:-1000}
|
||||
@ -12,7 +12,7 @@ id -u rtorrent &>/dev/null || \
|
||||
|
||||
# Update group/user IDs
|
||||
groupmod -o -g "$GROUP_ID" rtorrent
|
||||
usermod -o -u "$USER_ID" rtorrent 2>/dev/null
|
||||
usermod -o -u "$USER_ID" rtorrent &>/dev/null
|
||||
|
||||
# Copy default config
|
||||
if [ ! -e /home/rtorrent/.rtorrent.rc ]; then
|
||||
@ -20,5 +20,19 @@ if [ ! -e /home/rtorrent/.rtorrent.rc ]; then
|
||||
chown rtorrent:rtorrent /home/rtorrent/.rtorrent.rc
|
||||
fi
|
||||
|
||||
# Execute as the rtorrent user
|
||||
su - rtorrent -c "rtorrent"
|
||||
# Trap for graceful shutdown
|
||||
trap 'su - rtorrent -c "screen -S rtorrent -X stuff \"^Q\015\""; wait $SCREEN_PID' SIGTERM
|
||||
|
||||
# Start rtorrent in a detached screen session
|
||||
su - rtorrent -c "screen -dmS rtorrent rtorrent" &
|
||||
|
||||
# Wait for the su process to finish
|
||||
wait $!
|
||||
|
||||
# Find screen PID and monitor it
|
||||
SCREEN_PID=$(pgrep -f "SCREEN -dmS rtorrent")
|
||||
|
||||
# Keep the script running until the screen session ends
|
||||
tail --pid="$SCREEN_PID" -f /dev/null
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user