diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-25 19:13:31 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-25 19:24:33 +0900 |
| commit | 0dcac55a0c3fcbb2d48028a4474ccecb37bb22fc (patch) | |
| tree | d4f4440ac8ce805cbc46b8658572fe7a702d78fd /cmd | |
| parent | 6d202d73b41d28166f7bea7da36d1ce054711ff9 (diff) | |
hst/config: remove container etc field
This no longer needs special treatment since it can be specified as a generic filesystem entry.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/hakurei/print.go | 8 | ||||
| -rw-r--r-- | cmd/hakurei/print_test.go | 40 | ||||
| -rw-r--r-- | cmd/hpkg/app.go | 3 | ||||
| -rw-r--r-- | cmd/hpkg/with.go | 6 |
4 files changed, 28 insertions, 29 deletions
diff --git a/cmd/hakurei/print.go b/cmd/hakurei/print.go index 3e238d65..20bfdde3 100644 --- a/cmd/hakurei/print.go +++ b/cmd/hakurei/print.go @@ -12,7 +12,6 @@ import ( "text/tabwriter" "time" - "hakurei.app/container" "hakurei.app/hst" "hakurei.app/internal/app/state" "hakurei.app/internal/hlog" @@ -104,18 +103,11 @@ func printShowInstance( writeFlag("tty", params.Tty) writeFlag("mapuid", params.MapRealUID) writeFlag("directwl", config.DirectWayland) - writeFlag("autoetc", params.AutoEtc) if len(flags) == 0 { flags = append(flags, "none") } t.Printf(" Flags:\t%s\n", strings.Join(flags, " ")) - etc := params.Etc - if etc == nil { - etc = container.AbsFHSEtc - } - t.Printf(" Etc:\t%s\n", etc) - if config.Path != nil { t.Printf(" Path:\t%s\n", config.Path) } diff --git a/cmd/hakurei/print_test.go b/cmd/hakurei/print_test.go index 471cb358..d6c60ec4 100644 --- a/cmd/hakurei/print_test.go +++ b/cmd/hakurei/print_test.go @@ -41,13 +41,13 @@ func Test_printShowInstance(t *testing.T) { Groups: video, dialout, plugdev Data: /var/lib/hakurei/u0/org.chromium.Chromium Hostname: localhost - Flags: userns devel net abstract device tty mapuid autoetc - Etc: /etc/ + Flags: userns devel net abstract device tty mapuid Path: /run/current-system/sw/bin/chromium Arguments: chromium --ignore-gpu-blocklist --disable-smooth-scrolling --enable-features=UseOzonePlatform --ozone-platform=wayland Filesystem autoroot:w:/var/lib/hakurei/base/org.debian + autoetc:/etc/ w+ephemeral(-rwxr-xr-x):/tmp/ w*/nix/store:/mnt-root/nix/.rw-store/upper:/mnt-root/nix/.rw-store/work:/mnt-root/nix/.ro-store */nix/store @@ -83,14 +83,12 @@ App Identity: 0 Enablements: (no enablements) Flags: none - Etc: /etc/ `}, {"config nil entries", nil, &hst.Config{Container: &hst.ContainerConfig{Filesystem: make([]hst.FilesystemConfigJSON, 1)}, ExtraPerms: make([]*hst.ExtraPermConfig, 1)}, false, false, `App Identity: 0 Enablements: (no enablements) Flags: none - Etc: /etc/ Filesystem <invalid> @@ -120,13 +118,13 @@ App Groups: video, dialout, plugdev Data: /var/lib/hakurei/u0/org.chromium.Chromium Hostname: localhost - Flags: userns devel net abstract device tty mapuid autoetc - Etc: /etc/ + Flags: userns devel net abstract device tty mapuid Path: /run/current-system/sw/bin/chromium Arguments: chromium --ignore-gpu-blocklist --disable-smooth-scrolling --enable-features=UseOzonePlatform --ozone-platform=wayland Filesystem autoroot:w:/var/lib/hakurei/base/org.debian + autoetc:/etc/ w+ephemeral(-rwxr-xr-x):/tmp/ w*/nix/store:/mnt-root/nix/.rw-store/upper:/mnt-root/nix/.rw-store/work:/mnt-root/nix/.ro-store */nix/store @@ -287,6 +285,12 @@ App "special": true }, { + "type": "bind", + "dst": "/etc/", + "src": "/etc/", + "special": true + }, + { "type": "ephemeral", "dst": "/tmp/", "write": true, @@ -331,9 +335,7 @@ App "target": "/run/user/65534", "linkname": "/run/user/150" } - ], - "etc": "/etc/", - "auto_etc": true + ] } }, "time": "1970-01-01T00:00:00.000000009Z" @@ -441,6 +443,12 @@ App "special": true }, { + "type": "bind", + "dst": "/etc/", + "src": "/etc/", + "special": true + }, + { "type": "ephemeral", "dst": "/tmp/", "write": true, @@ -485,9 +493,7 @@ App "target": "/run/user/65534", "linkname": "/run/user/150" } - ], - "etc": "/etc/", - "auto_etc": true + ] } } `}, @@ -649,6 +655,12 @@ func Test_printPs(t *testing.T) { "special": true }, { + "type": "bind", + "dst": "/etc/", + "src": "/etc/", + "special": true + }, + { "type": "ephemeral", "dst": "/tmp/", "write": true, @@ -693,9 +705,7 @@ func Test_printPs(t *testing.T) { "target": "/run/user/65534", "linkname": "/run/user/150" } - ], - "etc": "/etc/", - "auto_etc": true + ] } }, "time": "1970-01-01T00:00:00.000000009Z" diff --git a/cmd/hpkg/app.go b/cmd/hpkg/app.go index e35dbf98..cd548dc8 100644 --- a/cmd/hpkg/app.go +++ b/cmd/hpkg/app.go @@ -94,6 +94,7 @@ func (app *appInfo) toHst(pathSet *appPathSet, pathname *container.Absolute, arg Tty: app.Tty || flagDropShell, MapRealUID: app.MapRealUID, Filesystem: []hst.FilesystemConfigJSON{ + {FilesystemConfig: &hst.FSBind{Target: container.AbsFHSEtc, Source: pathSet.cacheDir.Append("etc"), Special: true}}, {FilesystemConfig: &hst.FSBind{Source: pathSet.nixPath.Append("store"), Target: pathNixStore}}, {FilesystemConfig: &hst.FSBind{Source: pathSet.metaPath, Target: hst.AbsTmp.Append("app")}}, {FilesystemConfig: &hst.FSBind{Source: container.AbsFHSEtc.Append("resolv.conf"), Optional: true}}, @@ -108,8 +109,6 @@ func (app *appInfo) toHst(pathSet *appPathSet, pathname *container.Absolute, arg {pathBin, pathSwBin.String()}, {container.AbsFHSUsrBin, pathSwBin.String()}, }, - Etc: pathSet.cacheDir.Append("etc"), - AutoEtc: true, }, ExtraPerms: []*hst.ExtraPermConfig{ {Path: dataHome, Execute: true}, diff --git a/cmd/hpkg/with.go b/cmd/hpkg/with.go index acb503d1..21adeec4 100644 --- a/cmd/hpkg/with.go +++ b/cmd/hpkg/with.go @@ -49,6 +49,7 @@ func withNixDaemon( SeccompFlags: seccomp.AllowMultiarch, Tty: dropShell, Filesystem: []hst.FilesystemConfigJSON{ + {FilesystemConfig: &hst.FSBind{Target: container.AbsFHSEtc, Source: pathSet.cacheDir.Append("etc"), Special: true}}, {FilesystemConfig: &hst.FSBind{Source: pathSet.nixPath, Target: pathNix, Write: true}}, }, Link: []hst.LinkConfig{ @@ -56,8 +57,6 @@ func withNixDaemon( {pathBin, pathSwBin.String()}, {container.AbsFHSUsrBin, pathSwBin.String()}, }, - Etc: pathSet.cacheDir.Append("etc"), - AutoEtc: true, }, }), dropShell, beforeFail) } @@ -89,6 +88,7 @@ func withCacheDir( SeccompFlags: seccomp.AllowMultiarch, Tty: dropShell, Filesystem: []hst.FilesystemConfigJSON{ + {FilesystemConfig: &hst.FSBind{Target: container.AbsFHSEtc, Source: workDir.Append(container.FHSEtc), Special: true}}, {FilesystemConfig: &hst.FSBind{Source: workDir.Append("nix"), Target: pathNix}}, {FilesystemConfig: &hst.FSBind{Source: workDir, Target: hst.AbsTmp.Append("bundle")}}, }, @@ -97,8 +97,6 @@ func withCacheDir( {pathBin, pathSwBin.String()}, {container.AbsFHSUsrBin, pathSwBin.String()}, }, - Etc: workDir.Append(container.FHSEtc), - AutoEtc: true, }, }, dropShell, beforeFail) } |
