scanConfigsForRandomPassword iterates $configs_dir (manager-owned), so the placeholder grep/sed/awk on the config file -> runInstallOp. The bcrypt export log ($containers_dir/bcrypt.txt) is docker-install-owned, so its touch/chmod/ sed/grep/append -> runFileOp/runFileWrite (NOT runInstallOp). Covers all password_replace*/password_user_replace/password_update_all and bcrypt/*. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
20 lines
717 B
Bash
Executable File
20 lines
717 B
Bash
Executable File
#!/bin/bash
|
|
|
|
replaceRandomUsernames()
|
|
{
|
|
local file="$1"
|
|
|
|
# Only scan for placeholders that actually exist in the file
|
|
local existing_placeholders=$(runInstallOp grep -oE 'RANDOMIZEDUSERNAME[0-9]+' "$file" 2>/dev/null | sort -u)
|
|
|
|
if [[ -n "$existing_placeholders" ]]; then
|
|
while IFS= read -r username_placeholder; do
|
|
if [[ -n "$username_placeholder" ]]; then
|
|
local random_username=$(generateRandomUsername)
|
|
runInstallOp sed -i 's/'"${username_placeholder}"'/'"${random_username}"'/g' "$file"
|
|
checkSuccess "Updated ${username_placeholder} in $(basename "$file")."
|
|
fi
|
|
done <<< "$existing_placeholders"
|
|
fi
|
|
}
|