mirror of
https://github.com/clearlinux/rkt.git
synced 2026-06-16 02:05:48 +00:00
a1d7eb8e9c
The appc spec has moved! Its new home is at https://github.com/appc/spec This removes the spec (since it has already been migrated), and adds placeholders linking to the new repo. It also updates rocket to reference the spec repo _directly_ (i.e. NOT godepped). This means that people will need to maintain the spec in their gopath for now when building rocket.
58 lines
1.7 KiB
Go
58 lines
1.7 KiB
Go
package path
|
|
|
|
//
|
|
// Functions defining paths that are shared by different parts of rkt
|
|
// (e.g. stage0 and stage1)
|
|
//
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/appc/spec/schema/types"
|
|
)
|
|
|
|
const (
|
|
Stage1Dir = "/stage1"
|
|
stage2Dir = "/opt/stage2"
|
|
)
|
|
|
|
// Stage1RootfsPath returns the directory in root containing the rootfs for stage1
|
|
func Stage1RootfsPath(root string) string {
|
|
return filepath.Join(root, Stage1Dir)
|
|
}
|
|
|
|
// ContainerManifestPath returns the path in root to the Container Runtime Manifest
|
|
func ContainerManifestPath(root string) string {
|
|
return filepath.Join(root, "container")
|
|
}
|
|
|
|
// AppImagePath returns the path where an app image (i.e. unpacked ACI) is rooted (i.e.
|
|
// where its contents are extracted during stage0), based on the app image ID.
|
|
func AppImagePath(root string, imageID types.Hash) string {
|
|
return filepath.Join(root, Stage1Dir, stage2Dir, imageID.String())
|
|
}
|
|
|
|
// AppRootfsPath returns the path to an app's rootfs.
|
|
// imageID should be the app image ID.
|
|
func AppRootfsPath(root string, imageID types.Hash) string {
|
|
return filepath.Join(AppImagePath(root, imageID), "rootfs")
|
|
}
|
|
|
|
// RelAppImagePath returns the path of an application image relative to the
|
|
// stage1 chroot
|
|
func RelAppImagePath(imageID types.Hash) string {
|
|
return filepath.Join(stage2Dir, imageID.String())
|
|
}
|
|
|
|
// RelAppImagePath returns the path of an application's rootfs relative to the
|
|
// stage1 chroot
|
|
func RelAppRootfsPath(imageID types.Hash) string {
|
|
return filepath.Join(RelAppImagePath(imageID), "rootfs")
|
|
}
|
|
|
|
// ImageManifestPath returns the path to the app's manifest file inside the expanded ACI.
|
|
// id should be the app image ID.
|
|
func ImageManifestPath(root string, imageID types.Hash) string {
|
|
return filepath.Join(AppImagePath(root, imageID), "app")
|
|
}
|