additional_directories.sh: create host mount-point dirs for nested mounts
When a user's FileBrowser directory lives inside an existing bind-mount (e.g. /srv/data/users/alice), Docker needs an empty directory at the host-side equivalent path before it can overlay an inner bind-mount on top of the outer one. Without it the inner mount silently fails and the extra folder never appears. Now creates the mount-point directory on the host automatically before adding the compose entry, with a visible note so the user knows a dir was created. https://claude.ai/code/session_014CCYqVwW6d6f5dw1qRokYt
This commit is contained in:
@@ -255,6 +255,24 @@ do_add() {
|
||||
continue
|
||||
fi
|
||||
|
||||
# The container path may land inside an existing bind-mount (e.g. /srv/data/...).
|
||||
# Docker needs an empty mount-point directory to already exist on the host at that
|
||||
# location before it can overlay the inner mount on top of the outer one.
|
||||
# Derive the host equivalent: strip /srv/data prefix → prepend FB_PATH.
|
||||
local _mount_point_host=""
|
||||
if [[ "$_container_path" == /srv/data/* ]]; then
|
||||
_mount_point_host="$_fb_path/${_container_path#/srv/data/}"
|
||||
elif [[ "$_container_path" == /srv/* ]]; then
|
||||
# Legacy layout: /srv IS the bind mount
|
||||
_mount_point_host="$_fb_path/${_container_path#/srv/}"
|
||||
fi
|
||||
|
||||
if [[ -n "$_mount_point_host" && ! -d "$_mount_point_host" ]]; then
|
||||
mkdir -p "$_mount_point_host" \
|
||||
&& echo " ${DIM}Created mount point: $_mount_point_host${R}" \
|
||||
|| { errmsg "Could not create mount point '$_mount_point_host' — check permissions."; continue; }
|
||||
fi
|
||||
|
||||
add_volume_entry "$_host_path" "$_container_path" && _changed=true || true
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user