hst/fsbind: optional autoroot behaviour
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m17s
Test / Hakurei (push) Successful in 3m10s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m33s
Test / Hakurei (race detector) (push) Successful in 5m9s
Test / Flake checks (push) Successful in 1m23s

This allows autoroot to be configured via Filesystem.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-08-25 17:44:12 +09:00
parent 8db906ee64
commit 059164d4fa
2 changed files with 70 additions and 10 deletions

View File

@@ -62,5 +62,36 @@ func TestFSBind(t *testing.T) {
Target: m("/"),
}}, m("/"), ms("/"),
"*/"},
{"autoroot nil target", &hst.FSBind{
Source: m("/"),
AutoRoot: true,
}, false, nil, nil, nil, "<invalid>"},
{"autoroot bad target", &hst.FSBind{
Source: m("/"),
Target: m("/etc/"),
AutoRoot: true,
}, false, nil, nil, nil, "<invalid>"},
{"autoroot pd", &hst.FSBind{
Target: m("/"),
Source: m("/"),
Write: true,
AutoRoot: true,
}, true, container.Ops{&container.AutoRootOp{
Host: m("/"),
Flags: container.BindWritable,
}}, m("/"), ms("/"), "autoroot:w"},
{"autoroot silly", &hst.FSBind{
Target: m("/"),
Source: m("/etc"),
Write: true,
AutoRoot: true,
}, true, container.Ops{&container.AutoRootOp{
Host: m("/etc"),
Flags: container.BindWritable,
}}, m("/"), ms("/etc"), "autoroot:w:/etc"},
})
}