osbuild-composer: don't use hardcoded state directory
Use $STATE_DIRECTORY environment variable which is set by systemd because we use: StateDirectory=osbuild-composer in the service unit. also change systemd unit to include STATE_DIRECTORY, because RHEL comes with older systemd version, so we need to set this variable explicitly.
This commit is contained in:
parent
7957feff48
commit
9f4042af6c
2 changed files with 5 additions and 1 deletions
|
|
@ -54,7 +54,10 @@ func main() {
|
|||
flag.BoolVar(&verbose, "v", false, "Print access log")
|
||||
flag.Parse()
|
||||
|
||||
stateDir := "/var/lib/osbuild-composer"
|
||||
stateDir, ok := os.LookupEnv("STATE_DIRECTORY")
|
||||
if !ok {
|
||||
log.Fatal("STATE_DIRECTORY is not set. Is the service file missing StateDirectory=?")
|
||||
}
|
||||
|
||||
listeners, err := activation.ListenersWithNames()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ Restart=on-failure
|
|||
|
||||
# systemd >= 240 sets this, but osbuild-composer runs on earlier versions
|
||||
Environment="CACHE_DIRECTORY=/var/cache/osbuild-composer"
|
||||
Environment="STATE_DIRECTORY=/var/lib/osbuild-composer"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue