diff options
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 69cc10389..e85242028 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -1,6 +1,7 @@ package libpod import ( + "context" "fmt" "io/ioutil" "os" @@ -100,6 +101,8 @@ type Runtime struct { // unused. doRenumber bool + doMigrate bool + // valid indicates whether the runtime is ready to use. // valid is set to true when a runtime is returned from GetRuntime(), // and remains true until the runtime is shut down (rendering its @@ -109,6 +112,8 @@ type Runtime struct { // mechanism to read and write even logs eventer events.Eventer + + ctx context.Context } // OCIRuntimePath contains information about an OCI runtime. @@ -962,6 +967,24 @@ func makeRuntime(runtime *Runtime) (err error) { // further runtime.valid = true + if runtime.doMigrate { + if os.Geteuid() != 0 { + aliveLock.Unlock() + locked = false + + became, ret, err := rootless.BecomeRootInUserNS() + if err != nil { + return err + } + if became { + os.Exit(ret) + } + } + if err := runtime.migrate(); err != nil { + return err + } + } + return nil } |