fix(install): route the early .env tag substitutions through runFileOp

configFileSetupData runs as the manager (libreportal user) during install,
but writes into /libreportal-containers/<app>/, which is owned by the
container user (dockerinstall) under the three-root layout. The six bare
`sed -i` calls in this function were missing the `runFileOp` wrapper that
every other in-tree sed-on-app-files call already uses (e.g. setup_dns.sh's
WG_DEFAULT_DNS edits), so on first run `sed -i` failed to create its temp
file in the live dir:

    sed: couldn't open temporary file /libreportal-containers/linkding/sedaCaUNU: Permission denied
    ✗ Error Updated DOMAINSUBNAMEHERE with: bookmark.
    ! Notice Non-interactive mode: aborting on error.

…which aborted the install at step 3 of every per-app config setup.

Replace `result=$(sed -i ...)` with `result=$(runFileOp sed -i ...)` so each
substitution runs as the owner of the target file (via the bin-install
helper). All six call sites use the same pattern — done as a single
`replace_all` over the unique prefix.

Tags fixed: DOMAINSUBNAMEHERE, APPADDRESSHERE, DOMAINSUBNAME_DATA,
TIMEZONE_DATA, EMAILHERE, HOSTIPHERE.

Verified live on a fresh install: `libreportal app install linkding` now
completes cleanly through all 10 install steps and lands the container.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-26 17:36:51 +01:00
parent bc73e56ef0
commit 1f930cca74

View File

@ -18,22 +18,22 @@ configSetupFileWithData()
local full_file_path="$file_path/$file_name"
result=$(sed -i "s|DOMAINSUBNAMEHERE|$host_setup|g" "$full_file_path")
result=$(runFileOp sed -i "s|DOMAINSUBNAMEHERE|$host_setup|g" "$full_file_path")
checkSuccess "Updated DOMAINSUBNAMEHERE with: $host_setup"
result=$(sed -i "s|APPADDRESSHERE|$app_address|g" "$full_file_path")
result=$(runFileOp sed -i "s|APPADDRESSHERE|$app_address|g" "$full_file_path")
checkSuccess "Updated APPADDRESSHERE with: $app_address"
result=$(sed -i "s|DOMAINSUBNAME_DATA|$host_setup|g" "$full_file_path")
result=$(runFileOp sed -i "s|DOMAINSUBNAME_DATA|$host_setup|g" "$full_file_path")
checkSuccess "Updated DOMAINSUBNAME_DATA with: $host_setup"
result=$(sed -i "s|TIMEZONE_DATA|$CFG_TIMEZONE|g" "$full_file_path")
result=$(runFileOp sed -i "s|TIMEZONE_DATA|$CFG_TIMEZONE|g" "$full_file_path")
checkSuccess "Updated TIMEZONE_DATA with: $CFG_TIMEZONE"
result=$(sed -i "s|EMAILHERE|$CFG_TRAEFIK_EMAIL|g" "$full_file_path")
result=$(runFileOp sed -i "s|EMAILHERE|$CFG_TRAEFIK_EMAIL|g" "$full_file_path")
checkSuccess "Updated EMAILHERE with: $CFG_TRAEFIK_EMAIL"
result=$(sed -i "s|HOSTIPHERE|$public_ip_v4|g" "$full_file_path")
result=$(runFileOp sed -i "s|HOSTIPHERE|$public_ip_v4|g" "$full_file_path")
checkSuccess "Updated HOSTIPHERE with: $public_ip_v4"
scanFileForRandomPasswordKeysUsers "$full_file_path"