hst/fs: implement link fstype

Symlinks do not require special treatment, and doing this allows placing links in order.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-08-25 21:31:45 +09:00
parent 125f150784
commit 26cafe3e80
4 changed files with 126 additions and 0 deletions

View File

@@ -70,6 +70,16 @@ func TestFilesystemConfigJSON(t *testing.T) {
}, nil,
`{"type":"overlay","dst":"/nix/store","lower":["/mnt-root/nix/.ro-store"],"upper":"/mnt-root/nix/.rw-store/upper","work":"/mnt-root/nix/.rw-store/work"}`,
`{"fs":{"type":"overlay","dst":"/nix/store","lower":["/mnt-root/nix/.ro-store"],"upper":"/mnt-root/nix/.rw-store/upper","work":"/mnt-root/nix/.rw-store/work"},"magic":3236757504}`},
{"link", hst.FilesystemConfigJSON{
FilesystemConfig: &hst.FSLink{
Target: m("/run/current-system"),
Linkname: "/run/current-system",
Dereference: true,
},
}, nil,
`{"type":"link","dst":"/run/current-system","linkname":"/run/current-system","dereference":true}`,
`{"fs":{"type":"link","dst":"/run/current-system","linkname":"/run/current-system","dereference":true},"magic":3236757504}`},
}
for _, tc := range testCases {