Add --mount for host-dir bind mounts (e.g. a WebDAV share via rclone)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 07:35:30 +02:00
co-authored by Claude Sonnet 5
parent 4c754b20da
commit 7adf43dd03
17 changed files with 232 additions and 199 deletions
+15
View File
@@ -72,6 +72,21 @@ check "ids fixed at creation" bash -c "! '$DOOS' get_or_create --ids subui
check "bad size rejected" bash -c "! '$DOOS' get_or_create --size 1x z1"
check "size below minimum rejected" bash -c "! '$DOOS' get_or_create --size 1m z2"
check "size overflow rejected, not silently wrapped" bash -c "! '$DOOS' get_or_create --size 16777217t z3"
# --mount: extra bind mounts
mntd=$(mktemp -d); echo host-data > "$mntd/f"
"$DOOS" get_or_create --mount "$mntd:/data" m >/dev/null
[ "$("$DOOS" attach m -- cat /data/f)" = "host-data" ] && ok "mount: readable inside" || bad "mount: readable inside"
"$DOOS" attach m -- sh -c 'echo from-container > /data/g'
[ "$(cat "$mntd/g" 2>/dev/null)" = "from-container" ] && ok "mount: writes land on host" || bad "mount: writes land on host"
"$DOOS" delete --yes m >/dev/null
"$DOOS" get_or_create --mount "$mntd:/data:ro" mro >/dev/null
"$DOOS" attach mro -- sh -c 'echo x > /data/should-fail' 2>/dev/null && bad "mount: ro rejects writes" || ok "mount: ro rejects writes"
"$DOOS" delete --yes mro >/dev/null
check "mount: missing source rejected" bash -c "'$DOOS' get_or_create --mount /no/such/dir:/data mbad >/dev/null && ! '$DOOS' attach mbad -- true"
"$DOOS" delete --yes mbad >/dev/null 2>&1
check "mount: too many rejected" bash -c "! '$DOOS' get_or_create $(for i in 1 2 3 4 5 6 7 8 9; do printf -- '--mount %s:/m%s ' "$mntd" "$i"; done) mtoomany"
rm -rf "$mntd"
"$DOOS" attach s -- sh -c 'apt-get update >/dev/null 2>&1; apt-get install -y --no-install-recommends cowsay >/dev/null 2>&1; dpkg --audit && /usr/games/cowsay ok >/dev/null' && ok "host mode: apt install completes" || bad "host mode: apt install completes"
[ ! -e /usr/games/cowsay ] && ok "host untouched by apt install" || bad "host untouched by apt install"
"$DOOS" delete --yes s >/dev/null; "$DOOS" delete --yes s1 >/dev/null