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>
29 lines
820 B
Bash
Executable File
29 lines
820 B
Bash
Executable File
#!/bin/bash
|
|
|
|
copyFiles()
|
|
{
|
|
local silent_flag="$1"
|
|
local source="$2"
|
|
local save_dir="$3"
|
|
local user_name="$4" # advisory — the destination path determines the owner
|
|
|
|
# Write as the destination's owner (see copyFile).
|
|
local op="runInstallOp"
|
|
pathIsContainerData "$save_dir" && op="runFileOp"
|
|
|
|
local files=($($op find "$source" -type f))
|
|
if [ ${#files[@]} -eq 0 ]; then
|
|
echo "No files found in the source directory: $source"
|
|
fi
|
|
|
|
for file in "${files[@]}"; do
|
|
local file_name=$(basename "$file")
|
|
if [ "$silent_flag" == "loud" ]; then
|
|
local result; result=$($op cp -f "$file" "$save_dir")
|
|
checkSuccess "Copying $file_name to $save_dir"
|
|
else
|
|
$op cp -f "$file" "$save_dir" >/dev/null 2>&1
|
|
fi
|
|
done
|
|
}
|