-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.go
40 lines (37 loc) · 987 Bytes
/
install.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
package systemdconf
// Install describes the properties of a systemd installation section.
type Install struct {
Alias []string
WantedBy []string
RequiredBy []string
UpheldBy []string
Also []string
DefaultInstance string
}
// SectionName returns "Install" as the name of the configuration section.
func (i Install) SectionName() string {
return "Install"
}
// Directives returns the systemd directives for the [Install] section.
func (i Install) Directives() Directives {
var out Directives
for _, alias := range i.Alias {
out.Add("Alias", alias)
}
for _, wantedBy := range i.WantedBy {
out.Add("WantedBy", wantedBy)
}
for _, requiredBy := range i.RequiredBy {
out.Add("RequiredBy", requiredBy)
}
for _, upheldBy := range i.UpheldBy {
out.Add("UpheldBy", upheldBy)
}
for _, also := range i.Also {
out.Add("Also", also)
}
if i.DefaultInstance != "" {
out.Add("DefaultInstance", i.DefaultInstance)
}
return out
}