-
Notifications
You must be signed in to change notification settings - Fork 1
/
path.go
57 lines (46 loc) · 1.73 KB
/
path.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package path
//
// Functions defining paths that are shared by different parts of rkt
// (e.g. stage0 and stage1)
//
import (
"path/filepath"
"github.com/coreos/rocket/app-container/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. RAF) 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")
}
// AppManifestPath returns the path to the app's manifest file inside the expanded ACI.
// id should be the app image ID.
func AppManifestPath(root string, imageID types.Hash) string {
return filepath.Join(AppImagePath(root, imageID), "app")
}