docker-rtorrent/entrypoint.sh
Kris Lamoureux e9399f4344
Build rtorrent Docker image on Debian 12 slim
- 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
2024-09-10 00:44:12 -04:00

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"