Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: jason yang <jasonyangshadow@gmail.com>
  • Loading branch information
JasonYangShadow committed Jan 9, 2024
1 parent afee384 commit 04b813e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions internal/pkg/runtime/engine/apptainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ func create(ctx context.Context, engine *EngineOperations, rpcOps *client.RPC, p
return err
}

if err := system.RunBeforeTag(mount.BindsTag, c.patchLocaltime); err != nil {
return err
}

if err := c.addRootfsMount(system); err != nil {
return err
}
Expand Down Expand Up @@ -318,11 +322,6 @@ func create(ctx context.Context, engine *EngineOperations, rpcOps *client.RPC, p
close(mountAllErr)
close(driverMountErr)

err = c.patchLocaltime(system)
if err != nil {
return errors.Wrap(err, "patching /etc/localtime failure")
}

if engine.EngineConfig.GetSessionLayer() == apptainer.UnderlayLayer {
// Underlay bind points can interfere with unmounting
// the image, so unmount all those bind points first
Expand Down Expand Up @@ -3091,12 +3090,10 @@ func (c *container) patchLocaltime(system *mount.System) error {
if p, err := os.Readlink(localtime); err == nil {
// check whether the link target exists inside container
if _, err := os.Stat(c.session.RootFsPath() + p); err == nil {
sylog.Verbosef("%s inside container is symlink, will patch it to host target: %s", localtime, p)
if err := c.session.AddSymlink(localtime, p); err != nil {
return fmt.Errorf("could not add symlink %s -> %s inside container, err: %v", localtime, p, err)
}
if err := c.session.Update(); err != nil {
return fmt.Errorf("failed to update session info, err: %v", err)
}
}
}
}
Expand Down

0 comments on commit 04b813e

Please sign in to comment.