diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-06-18 03:51:49 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-06-18 03:51:49 +0900 |
| commit | 3938e8bce5948514f9a87cd5fe73a99142acc419 (patch) | |
| tree | 303bc85e469e71a895dc488ff129a3bd752f55d6 /cmd/app/app.go | |
| parent | aee15b4f2a1db3ba2d608b891ec6ea56fc3510e4 (diff) | |
cmd/app: multiple template uppers
Having multiple environments is useful, and this was trivial to implement.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/app/app.go')
| -rw-r--r-- | cmd/app/app.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cmd/app/app.go b/cmd/app/app.go index b5e5ee92..7dd8b651 100644 --- a/cmd/app/app.go +++ b/cmd/app/app.go @@ -35,6 +35,10 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) { shell := fhs.AbsRoot.Append("bin", "zsh") home := hst.AbsPrivateTmp.Append("home") + root := hst.FSOverlay{ + Target: fhs.AbsRoot, + Lower: []*check.Absolute{base.Append("initial")}, + } c := hst.Config{ ID: id, Enablements: new(hst.Enablements), @@ -51,13 +55,7 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) { Container: &hst.ContainerConfig{ Env: make(map[string]string), Filesystem: []hst.FilesystemConfigJSON{ - {FilesystemConfig: &hst.FSOverlay{ - Target: fhs.AbsRoot, - Lower: []*check.Absolute{ - base.Append("template", "initial"), - }, - Upper: base.Append("template", "upper"), - }}, + {FilesystemConfig: &root}, {FilesystemConfig: &hst.FSBind{ Target: home, Source: base.Append("state", id), @@ -102,10 +100,13 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) { if err := scanOnce(); err != nil { return nil, err } - if v, err := strconv.Atoi(s.Text()); err != nil { + if template, identity, ok := strings.Cut(s.Text(), ":"); !ok { + return nil, io.ErrUnexpectedEOF + } else if v, err := strconv.Atoi(identity); err != nil { return nil, err } else { c.Identity = v + root.Upper = base.Append("template", template, "upper") } if err := scanOnce(); err != nil { |
