container: call op method right before initial process
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m39s
Test / Sandbox (race detector) (push) Successful in 4m42s
Test / Hakurei (push) Successful in 4m51s
Test / Hpkg (push) Successful in 5m1s
Test / Hakurei (race detector) (push) Successful in 6m23s
Test / Flake checks (push) Successful in 1m41s
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m39s
Test / Sandbox (race detector) (push) Successful in 4m42s
Test / Hakurei (push) Successful in 4m51s
Test / Hpkg (push) Successful in 5m1s
Test / Hakurei (race detector) (push) Successful in 6m23s
Test / Flake checks (push) Successful in 1m41s
This is at a point considered to be already "within" the container. Daemons internal to the container can be started here. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
422efcf258
commit
5785714b64
@ -59,6 +59,7 @@ func (e *AutoEtcOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (e *AutoEtcOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (e *AutoEtcOp) hostPath() *check.Absolute { return fhs.AbsEtc.Append(e.hostRel()) }
|
func (e *AutoEtcOp) hostPath() *check.Absolute { return fhs.AbsEtc.Append(e.hostRel()) }
|
||||||
func (e *AutoEtcOp) hostRel() string { return ".host/" + e.Prefix }
|
func (e *AutoEtcOp) hostRel() string { return ".host/" + e.Prefix }
|
||||||
|
|||||||
@ -69,6 +69,7 @@ func (r *AutoRootOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (r *AutoRootOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (r *AutoRootOp) Is(op Op) bool {
|
func (r *AutoRootOp) Is(op Op) bool {
|
||||||
vr, ok := op.(*AutoRootOp)
|
vr, ok := op.(*AutoRootOp)
|
||||||
|
|||||||
@ -49,6 +49,8 @@ type (
|
|||||||
early(state *setupState, k syscallDispatcher) error
|
early(state *setupState, k syscallDispatcher) error
|
||||||
// apply is called in intermediate root.
|
// apply is called in intermediate root.
|
||||||
apply(state *setupState, k syscallDispatcher) error
|
apply(state *setupState, k syscallDispatcher) error
|
||||||
|
// late is called right before starting the initial process.
|
||||||
|
late(state *setupState, k syscallDispatcher) error
|
||||||
|
|
||||||
// prefix returns a log message prefix, and whether this Op prints no identifying message on its own.
|
// prefix returns a log message prefix, and whether this Op prints no identifying message on its own.
|
||||||
prefix() (string, bool)
|
prefix() (string, bool)
|
||||||
@ -330,6 +332,19 @@ func initEntrypoint(k syscallDispatcher, msg message.Msg) {
|
|||||||
}
|
}
|
||||||
k.umask(oldmask)
|
k.umask(oldmask)
|
||||||
|
|
||||||
|
// called right before startup of initial process, all state changes to the
|
||||||
|
// current process is prohibited during late
|
||||||
|
for i, op := range *params.Ops {
|
||||||
|
// ops already checked during early setup
|
||||||
|
if err := op.late(state, k); err != nil {
|
||||||
|
if m, ok := messageFromError(err); ok {
|
||||||
|
k.fatal(msg, m)
|
||||||
|
} else {
|
||||||
|
k.fatalf(msg, "cannot complete op at index %d: %v", i, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := closeSetup(); err != nil {
|
if err := closeSetup(); err != nil {
|
||||||
k.fatalf(msg, "cannot close setup pipe: %v", err)
|
k.fatalf(msg, "cannot close setup pipe: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,7 @@ func (b *BindMountOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
}
|
}
|
||||||
return k.bindMount(state, source, target, flags)
|
return k.bindMount(state, source, target, flags)
|
||||||
}
|
}
|
||||||
|
func (b *BindMountOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (b *BindMountOp) Is(op Op) bool {
|
func (b *BindMountOp) Is(op Op) bool {
|
||||||
vb, ok := op.(*BindMountOp)
|
vb, ok := op.(*BindMountOp)
|
||||||
|
|||||||
@ -126,6 +126,7 @@ func (d *MountDevOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
}
|
}
|
||||||
return k.mountTmpfs(SourceTmpfs, devShmPath, MS_NOSUID|MS_NODEV, 0, 01777)
|
return k.mountTmpfs(SourceTmpfs, devShmPath, MS_NOSUID|MS_NODEV, 0, 01777)
|
||||||
}
|
}
|
||||||
|
func (d *MountDevOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (d *MountDevOp) Is(op Op) bool {
|
func (d *MountDevOp) Is(op Op) bool {
|
||||||
vd, ok := op.(*MountDevOp)
|
vd, ok := op.(*MountDevOp)
|
||||||
|
|||||||
@ -27,6 +27,7 @@ func (m *MkdirOp) early(*setupState, syscallDispatcher) error { return nil }
|
|||||||
func (m *MkdirOp) apply(_ *setupState, k syscallDispatcher) error {
|
func (m *MkdirOp) apply(_ *setupState, k syscallDispatcher) error {
|
||||||
return k.mkdirAll(toSysroot(m.Path.String()), m.Perm)
|
return k.mkdirAll(toSysroot(m.Path.String()), m.Perm)
|
||||||
}
|
}
|
||||||
|
func (m *MkdirOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (m *MkdirOp) Is(op Op) bool {
|
func (m *MkdirOp) Is(op Op) bool {
|
||||||
vm, ok := op.(*MkdirOp)
|
vm, ok := op.(*MkdirOp)
|
||||||
|
|||||||
@ -205,6 +205,8 @@ func (o *MountOverlayOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
return k.mount(SourceOverlay, target, FstypeOverlay, 0, strings.Join(options, check.SpecialOverlayOption))
|
return k.mount(SourceOverlay, target, FstypeOverlay, 0, strings.Join(options, check.SpecialOverlayOption))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o *MountOverlayOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (o *MountOverlayOp) Is(op Op) bool {
|
func (o *MountOverlayOp) Is(op Op) bool {
|
||||||
vo, ok := op.(*MountOverlayOp)
|
vo, ok := op.(*MountOverlayOp)
|
||||||
return ok && o.Valid() && vo.Valid() &&
|
return ok && o.Valid() && vo.Valid() &&
|
||||||
|
|||||||
@ -57,6 +57,7 @@ func (t *TmpfileOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (t *TmpfileOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (t *TmpfileOp) Is(op Op) bool {
|
func (t *TmpfileOp) Is(op Op) bool {
|
||||||
vt, ok := op.(*TmpfileOp)
|
vt, ok := op.(*TmpfileOp)
|
||||||
|
|||||||
@ -28,6 +28,7 @@ func (p *MountProcOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
}
|
}
|
||||||
return k.mount(SourceProc, target, FstypeProc, MS_NOSUID|MS_NOEXEC|MS_NODEV, zeroString)
|
return k.mount(SourceProc, target, FstypeProc, MS_NOSUID|MS_NOEXEC|MS_NODEV, zeroString)
|
||||||
}
|
}
|
||||||
|
func (p *MountProcOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (p *MountProcOp) Is(op Op) bool {
|
func (p *MountProcOp) Is(op Op) bool {
|
||||||
vp, ok := op.(*MountProcOp)
|
vp, ok := op.(*MountProcOp)
|
||||||
|
|||||||
@ -26,6 +26,7 @@ func (*RemountOp) early(*setupState, syscallDispatcher) error { return nil }
|
|||||||
func (r *RemountOp) apply(state *setupState, k syscallDispatcher) error {
|
func (r *RemountOp) apply(state *setupState, k syscallDispatcher) error {
|
||||||
return k.remount(state, toSysroot(r.Target.String()), r.Flags)
|
return k.remount(state, toSysroot(r.Target.String()), r.Flags)
|
||||||
}
|
}
|
||||||
|
func (r *RemountOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (r *RemountOp) Is(op Op) bool {
|
func (r *RemountOp) Is(op Op) bool {
|
||||||
vr, ok := op.(*RemountOp)
|
vr, ok := op.(*RemountOp)
|
||||||
|
|||||||
@ -50,6 +50,8 @@ func (l *SymlinkOp) apply(state *setupState, k syscallDispatcher) error {
|
|||||||
return k.symlink(l.LinkName, target)
|
return k.symlink(l.LinkName, target)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *SymlinkOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (l *SymlinkOp) Is(op Op) bool {
|
func (l *SymlinkOp) Is(op Op) bool {
|
||||||
vl, ok := op.(*SymlinkOp)
|
vl, ok := op.(*SymlinkOp)
|
||||||
return ok && l.Valid() && vl.Valid() &&
|
return ok && l.Valid() && vl.Valid() &&
|
||||||
|
|||||||
@ -48,6 +48,7 @@ func (t *MountTmpfsOp) apply(_ *setupState, k syscallDispatcher) error {
|
|||||||
}
|
}
|
||||||
return k.mountTmpfs(t.FSName, toSysroot(t.Path.String()), t.Flags, t.Size, t.Perm)
|
return k.mountTmpfs(t.FSName, toSysroot(t.Path.String()), t.Flags, t.Size, t.Perm)
|
||||||
}
|
}
|
||||||
|
func (t *MountTmpfsOp) late(*setupState, syscallDispatcher) error { return nil }
|
||||||
|
|
||||||
func (t *MountTmpfsOp) Is(op Op) bool {
|
func (t *MountTmpfsOp) Is(op Op) bool {
|
||||||
vt, ok := op.(*MountTmpfsOp)
|
vt, ok := op.(*MountTmpfsOp)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user