fix: change doas with (proper) command_user

explaination: https://www.redhat.com/en/blog/sudo-rootless-podman
This commit is contained in:
Hane 2026-06-01 17:09:27 +02:00
commit 670dd1fc85

View file

@ -14,7 +14,9 @@ command="$PODMAN"
command_args="start --all --filter restart-policy=always" command_args="start --all --filter restart-policy=always"
name="podman-containers" name="podman-containers"
command_background=true command_background=true
command_user=hane
pidfile="/var/run/${RC_SVCNAME}.pid" pidfile="/var/run/${RC_SVCNAME}.pid"
#pidfile="/tmp/xdg/$UID-xdg-runtime-dir/${RC_SVCNAME}.pid"
output_log="/home/${CONTAINER_USER:-$DEFAULT_CONTAINER_USER}/pihanepi/orchestrating/${RC_SVCNAME}.log" output_log="/home/${CONTAINER_USER:-$DEFAULT_CONTAINER_USER}/pihanepi/orchestrating/${RC_SVCNAME}.log"
error_log="/home/${CONTAINER_USER:-$DEFAULT_CONTAINER_USER}/pihanepi/orchestrating/${RC_SVCNAME}.err" error_log="/home/${CONTAINER_USER:-$DEFAULT_CONTAINER_USER}/pihanepi/orchestrating/${RC_SVCNAME}.err"
@ -25,18 +27,18 @@ error_log="/home/${CONTAINER_USER:-$DEFAULT_CONTAINER_USER}/pihanepi/orchestrati
start() { start() {
ebegin "Starting Podman containers with restart policy" ebegin "Starting Podman containers with restart policy"
doas -u "$CONTAINER_USER" "$PODMAN" start --all --filter restart-policy=$RESTART_POLICY "$PODMAN" start --all --filter restart-policy=$RESTART_POLICY
eend $? eend $?
} }
stop() { stop() {
ebegin "Stopping Podman containers with restart policy" ebegin "Stopping Podman containers with restart policy"
CONTAINERS=$(doas -u "$CONTAINER_USER" "$PODMAN" container ls --filter restart-policy=$RESTART_POLICY -q) CONTAINERS=$("$PODMAN" container ls --filter restart-policy=$RESTART_POLICY -q)
if [ -n "$CONTAINERS" ]; then if [ -n "$CONTAINERS" ]; then
for CONTAINER in $CONTAINERS; do for CONTAINER in $CONTAINERS; do
doas -u "$CONTAINER_USER" "$PODMAN" stop "$CONTAINER" "$PODMAN" stop "$CONTAINER"
done done
eend $? eend $?
else else