From 029dd0a81bdc405225b6e00b55e74a74eabbd42d Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 9 Oct 2019 13:52:35 +0200 Subject: [PATCH] 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 --- Makefile | 14 +++++++++++--- distribution/Makefile | 23 ----------------------- 2 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 distribution/Makefile diff --git a/Makefile b/Makefile index 78f1a506b..d8a8c805a 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/distribution/Makefile b/distribution/Makefile deleted file mode 100644 index a5c558efa..000000000 --- a/distribution/Makefile +++ /dev/null @@ -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/