forked from RedHatInsights/rhc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
94 lines (84 loc) · 2.09 KB
/
constants.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package main
import "path/filepath"
var (
// Version is the version as described by git.
Version string
// ShortName is used as a prefix to binary file names.
ShortName string
// LongName is used in file and directory names.
LongName string
// TopicPrefix is used as a prefix to all MQTT topics in the client.
TopicPrefix string
// Provider is used when constructing user-facing string output to identify
// the agency providing the connection broker.
Provider string
// ServiceName us used for manipulating of yggdrasil service
// It can be branded to rhcd on RHEL
ServiceName string
)
// Installation directory prefix and paths. Values are specified by compile-time
// substitution values, and are then set to sane defaults at runtime if the
// value is a zero-value string.
var (
PrefixDir string
BinDir string
SbinDir string
LibexecDir string
DataDir string
DatarootDir string
ManDir string
DocDir string
SysconfDir string
LocalstateDir string
DbusInterfacesDir string
)
func init() {
if PrefixDir == "" {
PrefixDir = "/usr/local"
}
if BinDir == "" {
BinDir = filepath.Join(PrefixDir, "bin")
}
if SbinDir == "" {
SbinDir = filepath.Join(PrefixDir, "sbin")
}
if LibexecDir == "" {
LibexecDir = filepath.Join(PrefixDir, "libexec")
}
if DataDir == "" {
DataDir = filepath.Join(PrefixDir, "share")
}
if DatarootDir == "" {
DatarootDir = filepath.Join(PrefixDir, "share")
}
if ManDir == "" {
ManDir = filepath.Join(PrefixDir, "man")
}
if DocDir == "" {
DocDir = filepath.Join(PrefixDir, "doc")
}
if SysconfDir == "" {
SysconfDir = filepath.Join(PrefixDir, "etc")
}
if LocalstateDir == "" {
LocalstateDir = filepath.Join(PrefixDir, "var")
}
if DbusInterfacesDir == "" {
DbusInterfacesDir = filepath.Join(DataDir, "dbus-1", "interfaces")
}
if ShortName == "" {
ShortName = "rhc"
}
if LongName == "" {
LongName = "rhc"
}
if TopicPrefix == "" {
TopicPrefix = "rhc"
}
if Provider == "" {
Provider = "Red Hat"
}
if ServiceName == "" {
ServiceName = "yggdrasil"
}
}