-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·26 lines (23 loc) · 853 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·26 lines (23 loc) · 853 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
#!/bin/sh
# Already running as non-root (e.g. Unraid --user flag) — skip privilege setup
if [ "$(id -u)" != "0" ]; then
exec "$@"
fi
# Ensure data and fleet directories are writable by cashpilot
chown cashpilot:root /data 2>/dev/null || true
if [ -d "/fleet" ]; then
chown cashpilot:root /fleet 2>/dev/null || true
fi
# If Docker socket exists, ensure the cashpilot user can access it
SOCK=/var/run/docker.sock
if [ -S "$SOCK" ]; then
SOCK_GID=$(stat -c '%g' "$SOCK" 2>/dev/null || stat -f '%g' "$SOCK" 2>/dev/null)
if [ -n "$SOCK_GID" ] && [ "$SOCK_GID" != "0" ]; then
addgroup -g "$SOCK_GID" -S docker 2>/dev/null || true
addgroup cashpilot docker 2>/dev/null || true
else
# GID 0 means root owns the socket — add cashpilot to root group
addgroup cashpilot root 2>/dev/null || true
fi
fi
exec su-exec cashpilot "$@"