Blame SOURCES/autofs-5.0.7-fix-systemd-unidir-in-spec-file.patch

ab3a3d
autofs-5.0.7 - fix systemd unidir in spec file
ab3a3d
ab3a3d
From: Ian Kent <raven@themaw.net>
ab3a3d
ab3a3d
ab3a3d
---
ab3a3d
 CHANGELOG   |    1 +
ab3a3d
 autofs.spec |   16 ++++++++--------
ab3a3d
 2 files changed, 9 insertions(+), 8 deletions(-)
ab3a3d
ab3a3d
diff --git a/CHANGELOG b/CHANGELOG
ab3a3d
index b6b2679..ecdea0b 100644
ab3a3d
--- a/CHANGELOG
ab3a3d
+++ b/CHANGELOG
ab3a3d
@@ -35,6 +35,7 @@
ab3a3d
 - add symlink pseudo option.
ab3a3d
 - fix requires in spec file.
ab3a3d
 - fix libtirpc build option to require libtirpc-devel if needed.
ab3a3d
+- fix systemd unidir in spec file.
ab3a3d
 
ab3a3d
 25/07/2012 autofs-5.0.7
ab3a3d
 =======================
ab3a3d
diff --git a/autofs.spec b/autofs.spec
ab3a3d
index f77acc1..a768e44 100644
ab3a3d
--- a/autofs.spec
ab3a3d
+++ b/autofs.spec
ab3a3d
@@ -76,7 +76,7 @@ inkludera n
ab3a3d
 %setup -q
ab3a3d
 echo %{version}-%{release} > .version
ab3a3d
 %if %{with_systemd}
ab3a3d
-  %define _unitdir %{?_unitdir:/lib/systemd/system}
ab3a3d
+  %define unitdir %{?_unitdir:/lib/systemd/system}
ab3a3d
   %define systemd_configure_arg --with-systemd
ab3a3d
 %endif
ab3a3d
 %if %{with_libtirpc}
ab3a3d
@@ -95,7 +95,7 @@ CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
ab3a3d
 %install
ab3a3d
 rm -rf $RPM_BUILD_ROOT
ab3a3d
 %if %{with_systemd}
ab3a3d
-install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
ab3a3d
+install -d -m 755 $RPM_BUILD_ROOT%{unitdir}
ab3a3d
 %else
ab3a3d
 mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
ab3a3d
 %endif
ab3a3d
@@ -109,9 +109,13 @@ make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_R
ab3a3d
 echo make -C redhat
ab3a3d
 make -C redhat
ab3a3d
 %if %{with_systemd}
ab3a3d
-install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
ab3a3d
+# Configure can get this wrong when the unit files appear under /lib and /usr/lib
ab3a3d
+find $RPM_BUILD_ROOT -type f -name autofs.service -exec rm -f {} \;
ab3a3d
+install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{unitdir}/autofs.service
ab3a3d
+%define init_file_name %{unitdir}/autofs.service
ab3a3d
 %else
ab3a3d
 install -m 755 redhat/autofs.init $RPM_BUILD_ROOT/etc/rc.d/init.d/autofs
ab3a3d
+%define init_file_name /etc/rc.d/init.d/autofs
ab3a3d
 %endif
ab3a3d
 install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
ab3a3d
 
ab3a3d
@@ -170,11 +174,7 @@ fi
ab3a3d
 %files
ab3a3d
 %defattr(-,root,root)
ab3a3d
 %doc CREDITS CHANGELOG INSTALL COPY* README* samples/ldap* samples/autofs.schema samples/autofs_ldap_auth.conf
ab3a3d
-%if %{with_systemd}
ab3a3d
-%{_unitdir}/autofs.service
ab3a3d
-%else
ab3a3d
-%config /etc/rc.d/init.d/autofs
ab3a3d
-%endif
ab3a3d
+%config %{init_file_name}
ab3a3d
 %config(noreplace) /etc/auto.master
ab3a3d
 %config(noreplace,missingok) /etc/auto.misc
ab3a3d
 %config(noreplace,missingok) /etc/auto.net