Commit e5d9c4b1 authored by Julien Muchembled's avatar Julien Muchembled

rpm: better systemd integration

- Suse wants units in /usr/lib/systemd/system
- respect system-preset
parent 4c2284e2
DESTDIR = / DESTDIR = /
PREFIX = /usr/local PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man MANDIR = $(PREFIX)/share/man
UNITDIR = /lib/systemd/system
MANPAGELIST := $(patsubst %,docs/%,re6st-conf.1 re6st-registry.1 re6stnet.8) MANPAGELIST := $(patsubst %,docs/%,re6st-conf.1 re6st-registry.1 re6stnet.8)
NM = /etc/NetworkManager/dispatcher.d/50re6stnet NM = /etc/NetworkManager/dispatcher.d/50re6stnet
...@@ -12,7 +13,7 @@ all: $(MANPAGELIST) ...@@ -12,7 +13,7 @@ all: $(MANPAGELIST)
install: install-noinit install: install-noinit
for x in daemon/*.service; \ for x in daemon/*.service; \
do install -Dpm 0644 $$x $(DESTDIR)/lib/systemd/system/$${x##*/}; \ do install -Dpm 0644 $$x $(DESTDIR)$(UNITDIR)/$${x##*/}; \
done done
install-noinit: install-man install-noinit: install-man
......
%define _builddir %(pwd) %define _builddir %(pwd)
%define ver %(python re6st/version.py) %define ver %(python re6st/version.py)
%define units re6stnet.service re6st-registry.service
Summary: resilient, scalable, IPv6 network application Summary: resilient, scalable, IPv6 network application
Name: re6stnet Name: re6stnet
...@@ -25,7 +26,7 @@ make ...@@ -25,7 +26,7 @@ make
%install %install
set $RPM_BUILD_ROOT set $RPM_BUILD_ROOT
make install PREFIX=%_prefix MANDIR=%_mandir DESTDIR=$1 make install PREFIX=%_prefix MANDIR=%_mandir DESTDIR=$1 %{?_unitdir:UNITDIR=%{_unitdir}}
# Exclude man pages because they will be compressed. # Exclude man pages because they will be compressed.
find $1 -mindepth 1 -path \*%_mandir -prune -o \ find $1 -mindepth 1 -path \*%_mandir -prune -o \
-name re6st\* -prune -printf /%%P\\n > INSTALLED -name re6st\* -prune -printf /%%P\\n > INSTALLED
...@@ -39,18 +40,17 @@ rm -rf "$RPM_BUILD_ROOT" INSTALLED ...@@ -39,18 +40,17 @@ rm -rf "$RPM_BUILD_ROOT" INSTALLED
%post %post
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
/bin/systemctl enable re6stnet.service re6st-registry.service || : /bin/systemctl preset %{units} || :
fi >/dev/null 2>&1 fi >/dev/null 2>&1
%preun %preun
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
/bin/systemctl --no-reload disable re6stnet.service re6st-registry.service || : /bin/systemctl --no-reload disable %{units} || :
/bin/systemctl stop re6stnet.service re6st-registry.service || : /bin/systemctl stop %{units} || :
fi >/dev/null 2>&1 fi >/dev/null 2>&1
%postun %postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then if [ $1 -ge 1 ]; then
# only try to restart the registry (doing same for re6stnet could be troublesome) /bin/systemctl try-restart %{units} >/dev/null 2>&1 || :
/bin/systemctl try-restart re6st-registry.service >/dev/null 2>&1 || :
fi fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment