Whamcloud - gitweb
LU-9526 spec: Improve systemd compat in spec file 15/27215/5
authorGiuseppe Di Natale <dinatale2@llnl.gov>
Fri, 19 May 2017 20:23:54 +0000 (13:23 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Jun 2017 03:57:13 +0000 (03:57 +0000)
Few minor edits that make the systemd compatibility
in the lustre.spec file cleaner.

Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Change-Id: I02076c7806f2c7cb318a505943dca0ca5a030093
Reviewed-on: https://review.whamcloud.com/27215
Reviewed-by: Christopher J. Morrone <morrone2@llnl.gov>
Tested-by: Jenkins
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre.spec.in

index 03f8480..af05155 100644 (file)
        %endif
 %endif
 
-# Generic enable switch for systemd
-%if %{with systemd}
-%define _systemd 1
-%endif
-
 # RHEL >= 7 comes with systemd
 %if 0%{?rhel} >= 7
-%define _systemd 1
+%define with_systemd 1
 %endif
 
 # Fedora >= 15 comes with systemd, but only >= 18 has
 # the proper macros
 %if 0%{?fedora} >= 18
-%define _systemd 1
+%define with_systemd 1
 %endif
 
 # opensuse >= 12.1 comes with systemd, but only >= 13.1
 # has the proper macros
 %if 0%{?suse_version} >= 1310
-%define _systemd 1
+%define with_systemd 1
 %endif
 
 Summary: Lustre File System
@@ -153,7 +148,7 @@ BuildRequires: redhat-rpm-config
 %endif
 %endif
 
-%if 0%{?_systemd}
+%if %{with systemd}
 Requires(post): systemd
 Requires(preun): systemd
 Requires(postun): systemd
@@ -276,12 +271,6 @@ cd $RPM_BUILD_DIR/lustre-%{version}
 # build failures
 %define optflags -g -O2 -Werror
 
-%if 0%{?_systemd}
-    %define systemd --with-systemdsystemunitdir=%{_unitdir}
-%else
-    %define systemd --with-systemdsystemunitdir=no
-%endif
-
 CONFIGURE_ARGS="%{?configure_args}"
 if [ -n "$CONFIGURE_ARGS" ]; then
        # make sure %%kdir and %%kobjdir are not in the configure arguments
@@ -311,7 +300,8 @@ fi
        %{!?with_zfs:--without-zfs} \
        %{!?with_lnet_dlc:--disable-dlc} \
        %{!?with_manpages:--disable-manpages} \
-       %{systemd} \
+       %{!?with_systemd:--with-systemdsystemunitdir=no} \
+       %{?with_systemd:--with-systemdsystemunitdir=%{_unitdir}} \
        --with-linux=%{kdir} \
        --with-linux-obj=%{kobjdir} \
        --with-kmp-moddir=%{kmoddir}/%{name}
@@ -355,7 +345,7 @@ echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files
 %endif
 
 # systemd is on redhat, fedora, and suse
-%if 0%{?_systemd}
+%if %{with systemd}
 echo '%{_unitdir}/lnet.service' >>lustre.files
 %endif
 
@@ -367,7 +357,7 @@ echo '%{_sysconfdir}/sysconfig/lsvcgss' >>lustre.files
 echo '%{_sysconfdir}/init.d/lustre' >>lustre.files
 %endif
 
-%if 0%{!?_systemd:1}
+%if %{without systemd}
 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
 %endif
 
@@ -513,17 +503,17 @@ echo '%{_sbindir}/wiretest' >>lustre-tests.files
 %endif
 
 %post
-%if 0%{?_systemd}
+%if %{with systemd}
 %systemd_post lnet.service
 %endif
 
 %preun
-%if 0%{?_systemd}
+%if %{with systemd}
 %systemd_preun lnet.service
 %endif
 
 %postun
-%if 0%{?_systemd}
+%if %{with systemd}
 %systemd_postun_with_restart lnet.service
 %endif