-
Notifications
You must be signed in to change notification settings - Fork 1
/
path.go
41 lines (33 loc) · 1.12 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
package main
import (
"path/filepath"
"github.com/coreos/rocket/app-container/schema/types"
"github.com/coreos/rocket/path"
)
const (
servicesDir = path.Stage1Dir + "/usr/lib/systemd/system"
wantsDir = servicesDir + "/default.target.wants"
)
// ServiceName returns a sanitized (escaped) systemd service name
// for the given imageID
func ServiceName(imageID types.Hash) string {
return imageID.String() + ".service"
}
// WantsPath returns the systemd "wants" directory in root
func WantsPath(root string) string {
return filepath.Join(root, wantsDir)
}
// ServicesPath returns the systemd "services" directory in root
func ServicesPath(root string) string {
return filepath.Join(root, servicesDir)
}
// ServiceFilePath returns the path to the systemd service file
// path for the given imageID
func ServiceFilePath(root string, imageID types.Hash) string {
return filepath.Join(root, servicesDir, ServiceName(imageID))
}
// WantLinkPath returns the systemd "want" symlink path for the
// given imageID
func WantLinkPath(root string, imageID types.Hash) string {
return filepath.Join(root, wantsDir, ServiceName(imageID))
}