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

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