Docker materialises a missing bind-mount source as an empty directory when a
container starts. The WebUI compose mounts ./libreportal.config as a file, so a
container start before the config landed left a directory at that path — and it
was self-perpetuating:
- copyFolder's tar extract aborted the whole source copy with
"libreportal/libreportal.config: Cannot open: File exists" (exit 2)
- dockerConfigSetupToContainer guards on [ ! -f ], which a directory fails, so
copyFile dropped the real config INSIDE the stub
- the closing -e / -r sanity checks both pass on a directory
The installer then reported success while libreportal-service crash-looped on
EISDIR reading /app/libreportal.config, leaving the WebUI unreachable.
Add repairStubDirForFile: promote a same-named file out of the stub, drop the
directory, and report if the path still isn't a regular file. Call it before the
WebUI source copy and before the per-app config copy (covers every app, not just
the WebUI), and tighten the closing existence check from -e to -f so a stub can
never pass validation again.
Signed-off-by: librelad <librelad@digitalangels.vip>
45 lines
2.3 KiB
Bash
Executable File
45 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
installLibrePortalImageWebUI()
|
|
{
|
|
isHeader "LibrePortal WebUI Image"
|
|
|
|
isNotice "Building the LibrePortal WebUI Docker image..."
|
|
|
|
# The copy below writes into the dockerinstall-owned containers root. On a
|
|
# fresh install the general traversal/ownership reconcile runs LATER, so at
|
|
# this point the system root is still 750 (untraversable by the container user)
|
|
# and the containers root may still be manager-owned — the copy would fail.
|
|
# Establish traversal + containers-root ownership FIRST.
|
|
fixFolderPermissions
|
|
|
|
# A previous run that started the container before its config landed leaves
|
|
# libreportal.config as a Docker-created directory. The tar copy below can't
|
|
# extract a file over a directory ("Cannot open: File exists") and aborts the
|
|
# whole source copy, so clear the stub first.
|
|
repairStubDirForFile "$containers_dir/libreportal/libreportal.config" "loud"
|
|
|
|
local result; result=$(copyFolder "$install_containers_dir/libreportal" "$containers_dir" "$sudo_user_name")
|
|
checkSuccess "Copy the LibrePortal to the containers folder"
|
|
|
|
reconcileWebuiDirOwnership
|
|
|
|
# copyFolder just restored the TEMPLATE docker-compose.yml, which carries raw
|
|
# #LIBREPORTAL|TAG|VALUE placeholders. On a fresh install the following
|
|
# dockerInstallApp (installLibrePortalAppWebUI) substitutes them; but on a
|
|
# REBUILD/update (libreportal already installed — this also runs via the WebUI
|
|
# deploy) nothing else does, leaving the at-rest compose unparseable by a plain
|
|
# `docker compose` (e.g. "invalid boolean: HEALTHCHECK_DATA"). Re-apply the tag
|
|
# processors here — the same self-heal up_app.sh uses — so the runtime compose
|
|
# is always fully substituted at rest, not just when started via the CLI.
|
|
if declare -F dockerConfigSetupFileWithData >/dev/null 2>&1 \
|
|
&& [[ "$(dockerCheckAppInstalled libreportal docker)" != "not_installed" ]]; then
|
|
initializeAppVariables libreportal >/dev/null 2>&1 || true
|
|
dockerConfigSetupFileWithData libreportal >/dev/null 2>&1 || true
|
|
checkSuccess "Re-applied LibrePortal WebUI compose tag substitutions"
|
|
fi
|
|
|
|
isNotice "Building libreportal-service image, this may take a while..."
|
|
local result; result=$(runFileOp docker build -t libreportal-service -f $containers_dir/libreportal/Dockerfile $containers_dir/libreportal >/dev/null 2>&1)
|
|
checkSuccess "Built LibrePortal WebUI Docker image"
|
|
} |