#!/bin/bash # Nextcloud install hooks. # # The compose bind-mounts ./resources/nginx.conf into the web container, but # nothing ever copied that file into the container tree — so on a fresh install # Docker did what Docker does with a missing bind source and created a DIRECTORY # in its place. nginx then refused to start with: # # error mounting ".../resources/nginx.conf" to rootfs at "/etc/nginx/nginx.conf": # not a directory: Are you trying to mount a directory onto a file? # # The app still "installed" — three of four containers came up and the app was # recorded as installed — so it failed quietly, with only the web front end # missing. Apps that need a resource file declare the copy in a hook (authelia # does exactly this); Nextcloud never had one. # # post_compose is the right point: the compose file is written, permissions and # `up` have not run yet, so the mount source exists before anything reads it. nextcloud_install_post_compose() { local app_name="$1" # Clear a stub directory left behind by any previous attempt, otherwise the # copy lands INSIDE it (resources/nginx.conf/nginx.conf) and the mount fails # exactly as before. Shared helper — same repair the WebUI's own config uses. repairStubDirForFile "$containers_dir$app_name/resources/nginx.conf" "loud" local result result=$(copyResource "$app_name" "nginx.conf" "resources" | runInstallWrite -a "$logs_dir/$docker_log_file" 2>&1) checkSuccess "Copying nginx.conf to $containers_dir$app_name/resources" }