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

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