From c9facb746b7be0f2d8f6b9b2227340ba2ec12060 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 26 Aug 2025 00:52:49 +0900 Subject: hst/config: remove data field, rename dir to home There is no reason to give the home directory special treatment, as this behaviour can be quite confusing. The home directory also does not necessarily require its own mount point, it could be provided by a parent or simply be ephemeral. Signed-off-by: Ophestra --- internal/app/seal_linux.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'internal/app/seal_linux.go') diff --git a/internal/app/seal_linux.go b/internal/app/seal_linux.go index c2b580b7..36984c5e 100644 --- a/internal/app/seal_linux.go +++ b/internal/app/seal_linux.go @@ -144,8 +144,6 @@ type hsuUser struct { // supplementary group ids supp []string - // home directory host path - data *container.Absolute // app user home directory home *container.Absolute // passwd database username @@ -161,8 +159,8 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co if config == nil { return hlog.WrapErr(syscall.EINVAL, syscall.EINVAL.Error()) } - if config.Data == nil { - return hlog.WrapErr(os.ErrInvalid, "invalid data directory") + if config.Home == nil { + return hlog.WrapErr(os.ErrInvalid, "invalid path to home directory") } { @@ -183,8 +181,7 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co seal.user = hsuUser{ aid: newInt(config.Identity), - data: config.Data, - home: config.Dir, + home: config.Home, username: config.Username, } if seal.user.username == "" { @@ -194,9 +191,6 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co return hlog.WrapErr(ErrName, fmt.Sprintf("invalid user name %q", seal.user.username)) } - if seal.user.home == nil { - seal.user.home = seal.user.data - } if u, err := sys.Uid(seal.user.aid.unwrap()); err != nil { return err } else { @@ -244,6 +238,7 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co Tty: true, Filesystem: []hst.FilesystemConfigJSON{ + // autoroot, includes the home directory {&hst.FSBind{ Target: container.AbsFHSRoot, Source: container.AbsFHSRoot, @@ -347,7 +342,6 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co if seal.user.username != "" { username = seal.user.username } - seal.container.Bind(seal.user.data, seal.user.home, container.BindWritable) seal.container.Dir = seal.user.home seal.env["HOME"] = seal.user.home.String() seal.env["USER"] = username -- cgit v1.3.1