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

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