Kris Lamoureux
e9399f4344
- Create multi-stage Dockerfile for libtorrent/rtorrent compilation - Set up runtime image with binaries, config, and entrypoint script - Implement Makefile and docker-compose for build/cleanup processes - Entrypoint script for user creation and config setup
25 lines
617 B
Bash
Executable File
25 lines
617 B
Bash
Executable File
#!/bin/bash
|
|
set -eu
|
|
|
|
# GID/UID
|
|
USER_ID=${GUID:-1000}
|
|
GROUP_ID=${PGID:-1000}
|
|
|
|
# Create group/user
|
|
getent group rtorrent >/dev/null || groupadd -g "$GROUP_ID" rtorrent
|
|
id -u rtorrent &>/dev/null || \
|
|
useradd -m -u "$USER_ID" -g rtorrent -s /bin/bash rtorrent
|
|
|
|
# Update group/user IDs
|
|
groupmod -o -g "$GROUP_ID" rtorrent
|
|
usermod -o -u "$USER_ID" rtorrent 2>/dev/null
|
|
|
|
# Copy default config
|
|
if [ ! -e /home/rtorrent/.rtorrent.rc ]; then
|
|
cp /tmp/rtorrent.rc.template /home/rtorrent/.rtorrent.rc
|
|
chown rtorrent:rtorrent /home/rtorrent/.rtorrent.rc
|
|
fi
|
|
|
|
# Execute as the rtorrent user
|
|
su - rtorrent -c "rtorrent"
|