librelad 99460cb05e fix(rooted): run dockerCommandRun via bash -c so pipes/redirects work
The rooted branch executed the command string as bare $command, which
word-splits without shell interpretation: pipes, redirects, && and quoted
Go templates were passed as literal argv to a single process. Nearly every
caller relies on shell syntax (docker ps | xargs -r ..., cd && docker
compose, --format='{{...}}', > /dev/null), so rooted mode silently
mishandled them — most visibly dockerStartAllApps after its pipe rewrite,
which failed with 'unknown shorthand flag: r'. Run via bash -c like the
rootless path so both modes share identical shell semantics. No caller uses
the sudo type arg.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-24 13:05:24 +01:00

18 lines
388 B
Bash
Executable File

#!/bin/bash
dockerCommandRun()
{
local command="$1"
local type="$2" # sudo
if [[ $CFG_DOCKER_INSTALL_TYPE == "rootless" ]]; then
dockerCommandRunInstallUser "$command"
elif [[ $CFG_DOCKER_INSTALL_TYPE == "rooted" ]]; then
if [[ $type == "sudo" ]]; then
sudo bash -c "$command"
else
bash -c "$command"
fi
fi
}