spec: add systemd hooks

According to Fedora packaging guidelines, the rpm scriptlets must
call into systemd to make sure the services are enabled/disabled
corerctly on install and uninstall.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-11-11 18:55:20 +01:00 committed by Lars Karlitski
parent 88c0cf4b27
commit 339e887693

View file

@ -21,6 +21,7 @@ License: ASL 2.0
URL: %{gourl}
Source0: %{gosource}
BuildRequires: systemd-rpm-macros
BuildRequires: systemd
BuildRequires: golang(github.com/coreos/go-systemd/activation)
BuildRequires: golang(github.com/google/uuid)
@ -41,7 +42,6 @@ for cmd in cmd/* ; do
%gobuild -o _bin/$(basename $cmd) %{goipath}/$cmd
done
%install
install -m 0755 -vd %{buildroot}%{_libexecdir}/osbuild-composer
install -m 0755 -vp _bin/* %{buildroot}%{_libexecdir}/osbuild-composer/
@ -68,6 +68,15 @@ export GOPATH=$(pwd)/_build:%{gopath}
%endif
%post
%systemd_post osbuild-composer.service osbuild-composer.socket osbuild-worker@.service
%preun
%systemd_preun osbuild-composer.service osbuild-composer.socket osbuild-worker@.service
%postun
%systemd_postun_with_restart osbuild-composer.service osbuild-composer.socket osbuild-worker@.service
%files
%license LICENSE
%doc README.md