Two mechanical sweeps, no behaviour change on a single-root install. The 14 `[[ "$p" == "$containers_dir"* ]]` prefix tests that decide manager-vs-container-user elevation become pathIsContainerData, so a file on a second storage root is no longer misclassified as manager-owned — which would have written it with the wrong owner and failed later, far from the cause. The 65 references to the WebUI's own tree become webuiDir(), which is pinned to the primary root by design. Two traps found while doing it: run_privileged.sh is sourced directly by init.sh without paths.sh, so it needs a fallback. Defining one named pathIsContainerData was wrong: generate_function_manifest.sh indexes top-level definitions, and the resulting autoload stub would have shadowed the real multi-root implementation with the primary-only fallback — silently classifying every file on a second disk as manager-owned, which is exactly the bug this sweep exists to prevent. Renamed to _runCfgIsContainerPath, which delegates when the real one is loaded. setup_lock.sh built its path in a top-level assignment, so it was evaluated at source time and needed the file flagged eager. Made it a function instead: the path resolves on call, and the file drops off LP_EAGER_FILES entirely. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
37 lines
1.5 KiB
Bash
Executable File
37 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Create an empty file with the correct owner FOR ITS LOCATION.
|
|
# under /docker/containers/<app>/ -> app data, owned by the docker install
|
|
# user -> create via runFileOp.
|
|
# anywhere else -> manager control plane -> runInstallOp
|
|
# (the current/manager user).
|
|
# Creating the file directly as the right owner avoids chown-to-another-user,
|
|
# which needs real root and isn't available to the unprivileged runtime.
|
|
# $2 (user_name) is kept for call-site compatibility but is now advisory — the
|
|
# path decides the owner, so a stale hint (e.g. passing the manager user for a
|
|
# file that lives under containers/) no longer lands the file with the wrong
|
|
# owner. Parent dirs are created with the same owner.
|
|
createTouch()
|
|
{
|
|
local file="$1"
|
|
local user_name="$2" # advisory; location determines the real owner
|
|
local silent_flag="$3"
|
|
local clean_file=$(echo "$file" | sed 's#//*#/#g')
|
|
local file_name=$(basename "$clean_file")
|
|
local file_dir=$(dirname "$clean_file")
|
|
|
|
local op="runInstallOp"
|
|
if pathIsContainerData "$clean_file"; then
|
|
op="runFileOp"
|
|
fi
|
|
|
|
if [ "$silent_flag" == "silent" ]; then
|
|
$op mkdir -p "$file_dir" 2>/dev/null
|
|
$op touch "$clean_file"
|
|
else
|
|
local result; result=$($op mkdir -p "$file_dir")
|
|
local result; result=$($op touch "$clean_file")
|
|
checkSuccess "Touching $file_name"
|
|
fi
|
|
}
|