-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·28 lines (22 loc) · 855 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·28 lines (22 loc) · 855 Bytes
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
#!/bin/sh
# Piratarr container entrypoint
# Handles PUID/PGID for proper file permissions, then starts the application.
CONFIG_DIR="${PIRATARR_CONFIG_DIR:-/config}"
# If running as root, adjust UID/GID and re-exec as piratarr user
if [ "$(id -u)" = "0" ]; then
PUID="${PUID:-1000}"
PGID="${PGID:-1000}"
# Update the piratarr group/user to match requested IDs
if [ "$(id -g piratarr)" != "$PGID" ]; then
groupmod -o -g "$PGID" piratarr
fi
if [ "$(id -u piratarr)" != "$PUID" ]; then
usermod -o -u "$PUID" piratarr
fi
echo "Starting Piratarr with UID=$(id -u piratarr) GID=$(id -g piratarr)"
mkdir -p "$CONFIG_DIR"
chown piratarr:piratarr "$CONFIG_DIR"
exec gosu piratarr python entrypoint.py
fi
# If running as non-root (e.g. user set --user), just start directly
exec python entrypoint.py