mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-16 02:23:02 +03:00
feat: native support for rootless container execution
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
exec logutil-service /dev/shm/logs/certsync
|
||||
exec /usr/local/bin/logutil /dev/shm/logs/certsync/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
exec logutil-service /dev/shm/logs/frigate
|
||||
exec /usr/local/bin/logutil /dev/shm/logs/frigate/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
exec logutil-service /dev/shm/logs/go2rtc
|
||||
exec /usr/local/bin/logutil /dev/shm/logs/go2rtc/
|
||||
|
||||
@@ -7,5 +7,7 @@ set -o errexit -o nounset -o pipefail
|
||||
dirs=(/dev/shm/logs/frigate /dev/shm/logs/go2rtc /dev/shm/logs/nginx /dev/shm/logs/certsync)
|
||||
|
||||
mkdir -p "${dirs[@]}"
|
||||
chown nobody:nogroup "${dirs[@]}"
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
chown nobody:nogroup "${dirs[@]}"
|
||||
fi
|
||||
chmod 02755 "${dirs[@]}"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/command/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
exec logutil-service /dev/shm/logs/nginx
|
||||
exec /usr/local/bin/logutil /dev/shm/logs/nginx/
|
||||
|
||||
@@ -65,6 +65,11 @@ function set_worker_processes() {
|
||||
|
||||
set_worker_processes
|
||||
|
||||
# NGINX cannot switch users if running rootless; strip the directive
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
sed -i '/^user root;/d' /usr/local/nginx/conf/nginx.conf || true
|
||||
fi
|
||||
|
||||
# ensure the directory for ACME challenges exists
|
||||
mkdir -p /etc/letsencrypt/www
|
||||
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/command/with-contenv bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
LOG_DIR=$1
|
||||
|
||||
if [ -z "$LOG_DIR" ]; then
|
||||
echo "Usage: $0 <log-dir>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CMD=(s6-log -b -- ${S6_LOGGING_SCRIPT:-n20 s1000000 T} "$LOG_DIR")
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
exec /command/s6-envuidgid nobody /command/s6-applyuidgid -U -- "${CMD[@]}"
|
||||
else
|
||||
exec "${CMD[@]}"
|
||||
fi
|
||||
Reference in New Issue
Block a user