Skip to content

Commit

Permalink
initsystems/systemd: Install tmpfiles config when installing unitfile
Browse files Browse the repository at this point in the history
Fixes bug#332
  • Loading branch information
bleve committed Nov 12, 2018
1 parent 315c1fd commit 3dda170
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
17 changes: 15 additions & 2 deletions initsystems/systemd/Makefile
Expand Up @@ -5,6 +5,9 @@ endif
SYSTEMUNITDIR=$(shell pkg-config systemd --variable=systemdsystemunitdir)
UNITFILE=ipsec.service
UNITDIR=$(DESTDIR)$(SYSTEMUNITDIR)
SYSTEMTMPFILESDIR=$(shell pkg-config systemd --variable=tmpfilesdir)
TMPFILESCONFIG=libreswan.conf
TMPFILESDIR=$(DESTDIR)$(SYSTEMTMPFILESDIR)

include $(top_srcdir)/Makefile.inc

Expand All @@ -15,10 +18,17 @@ include $(top_srcdir)/Makefile.inc
# like local-base and installsystemdservice are allowed to run in
# parallel)

local-base: $(builddir)/$(UNITFILE)
local-base: $(builddir)/$(UNITFILE) $(builddir)/$(TMPFILESCONFIG)

local-install-base: installsystemdservice oldinitdcheck postcheck

installtmpfilesconfig: local-base | $(TMPFILESDIR)
$(INSTALL) $(INSTCONFFLAGS) $(builddir)/$(TMPFILESCONFIG) $(TMPFILESDIR)
@if test $(TMPFILESDIR) = $(SYSTEMTMPFILESDIR) ; then \
echo running: systemd-tmpfiles --create $(TMPFILESDIR)/$(TMPFILESCONFIG); \
systemd-tmpfiles --create $(TMPFILESDIR)/$(TMPFILESCONFIG); \
fi

installsystemdservice: local-base | $(UNITDIR)
$(INSTALL) $(INSTCONFFLAGS) $(builddir)/$(UNITFILE) $(UNITDIR)
@if test $(UNITDIR) = $(SYSTEMUNITDIR) ; then \
Expand All @@ -33,6 +43,9 @@ installsystemdservice: local-base | $(UNITDIR)
$(UNITDIR):
mkdir -p $(UNITDIR)

$(TMPFILESDIR):
mkdir -p $(TMPFILESDIR)

oldinitdcheck: installsystemdservice
@if test -f $(DESTDIR)/etc/init.d/ipsec* ; then \
if egrep -i '(openswan|libreswan)' $(DESTDIR)/etc/init.d/ipsec* > /dev/null 2>&1 ; then \
Expand All @@ -46,7 +59,7 @@ oldinitdcheck: installsystemdservice
fi ; \
fi

postcheck: installsystemdservice oldinitdcheck
postcheck: installsystemdservice installtmpfilesconfig oldinitdcheck
@if test -z "$(DESTDIR)" -a $(UNITDIR) = $(SYSTEMUNITDIR) -a $(shell systemctl is-enabled ipsec.service) = "disabled" ; then \
echo "DESTDIR='$(DESTDIR)'" ; \
echo "************************** WARNING ***********************************" ; \
Expand Down
1 change: 1 addition & 0 deletions initsystems/systemd/libreswan.conf.in
@@ -0,0 +1 @@
d @IPSEC_RUNDIR@ 755 root root -
1 change: 0 additions & 1 deletion packaging/debian/libreswan.install
@@ -1,2 +1 @@
debian/90-libreswan.preset lib/systemd/system-preset
debian/tmpfiles/libreswan.conf usr/lib/tmpfiles.d
1 change: 0 additions & 1 deletion packaging/debian/tmpfiles/libreswan.conf

This file was deleted.

4 changes: 0 additions & 4 deletions packaging/fedora/libreswan-testing.spec.in
Expand Up @@ -132,10 +132,6 @@ install -d %{buildroot}%{_sysconfdir}/sysctl.d
install -m 0644 packaging/fedora/libreswan-sysctl.conf \
%{buildroot}%{_sysconfdir}/sysctl.d/50-libreswan.conf

install -d %{buildroot}%{_tmpfilesdir}
install -m 0644 packaging/fedora/libreswan-tmpfiles.conf \
%{buildroot}%{_tmpfilesdir}/libreswan.conf

mkdir -p %{buildroot}%{_libdir}/fipscheck

echo "include %{_sysconfdir}/ipsec.d/*.secrets" \
Expand Down
1 change: 0 additions & 1 deletion packaging/fedora/libreswan-tmpfiles.conf

This file was deleted.

4 changes: 0 additions & 4 deletions packaging/fedora/libreswan.spec
Expand Up @@ -146,10 +146,6 @@ install -d %{buildroot}%{_sysconfdir}/sysctl.d
install -m 0644 packaging/fedora/libreswan-sysctl.conf \
%{buildroot}%{_sysconfdir}/sysctl.d/50-libreswan.conf

install -d %{buildroot}%{_tmpfilesdir}
install -m 0644 packaging/fedora/libreswan-tmpfiles.conf \
%{buildroot}%{_tmpfilesdir}/libreswan.conf

mkdir -p %{buildroot}%{_libdir}/fipscheck

echo "include %{_sysconfdir}/ipsec.d/*.secrets" \
Expand Down
4 changes: 0 additions & 4 deletions packaging/rhel/7/libreswan.spec
Expand Up @@ -140,10 +140,6 @@ install -d %{buildroot}%{_sysconfdir}/sysctl.d
install -m 0644 packaging/rhel/libreswan-sysctl.conf \
%{buildroot}%{_sysconfdir}/sysctl.d/50-libreswan.conf

install -d %{buildroot}%{_tmpfilesdir}
install -m 0644 packaging/rhel/libreswan-tmpfiles.conf \
%{buildroot}%{_tmpfilesdir}/libreswan.conf

mkdir -p %{buildroot}%{_libdir}/fipscheck
install -d %{buildroot}%{_sysconfdir}/prelink.conf.d/
install -m644 packaging/rhel/libreswan-prelink.conf \
Expand Down
1 change: 0 additions & 1 deletion packaging/rhel/libreswan-tmpfiles.conf

This file was deleted.

0 comments on commit 3dda170

Please sign in to comment.