build-sys: rework makefiles

Unify into one make file, with two targets:

build:
  This unconditionally builds the binaries that wolud be shipped in the package,
  this is marked as a phony target, and relies on the go compiler to know what
  is up-to-date and what needs to be rebuilt.

install:
  This installs binaries and config files into the file system and runs any
  scripts to set things up correctly, as if the rpm had been installed.

This drops the old `run` target, which could still be done from the commandline,
but we want to be able to rely on systemd features, so it is not something we
want to test or support.

To run osbuild-composer from a checkout one should now do:
```
$ make build
$ sudo make install
```

This has the same effect as installing the RPM would have, starting and stopping
the sokcets/services is still left to the user.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-10-09 13:52:35 +02:00 committed by Lars Karlitski
parent d5830a4794
commit 029dd0a81b
2 changed files with 11 additions and 26 deletions

View file

@ -1,12 +1,20 @@
.PHONY: build
build:
go build -o osbuild-composer ./cmd/osbuild-composer/
go build -o osbuild-worker ./cmd/osbuild-worker/
.PHONY: install
install:
- mkdir -p /usr/lib/osbuild-composer
cp osbuild-composer /usr/lib/osbuild-composer/
cp osbuild-worker /usr/lib/osbuild-composer/
cp dnf-json /usr/lib/osbuild-composer/
run-socket:
systemd-socket-activate -l /run/weldr/api.socket -l /run/osbuild-composer/job.socket ./osbuild-composer
- mkdir -p /etc/sysusers.d/
cp distribution/osbuild-composer.conf /etc/sysusers.d/
systemd-sysusers osbuild-composer.conf
- mkdir -p /etc/systemd/system/
cp distribution/*.service /etc/systemd/system/
cp distribution/*.socket /etc/systemd/system/
systemctl daemon-reload
systemctl enable osbuild-composer.socket
systemctl enable osbuild-worker@1.service

View file

@ -1,23 +0,0 @@
sd-install:
cp *.service /etc/systemd/system/
cp *.socket /etc/systemd/system/
systemctl daemon-reload
sd-start:
systemctl start osbuild-composer.socket
systemctl start osbuild-worker@1.service
sd-enable:
systemctl enable osbuild-composer.socket
systemctl enable osbuild-worker@1.service
sd-stop:
systemctl disable osbuild-composer.socket
systemctl stop osbuild-composer.socket
systemctl stop osbuild-composer.service
systemctl disable osbuild-worker@1.service
systemctl stop osbuild-worker@1.service
user-install:
- mkdir -p /etc/sysusers.d/
cp osbuild-composer.conf /etc/sysusers.d/