]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
redhat: make systemd stuff also works with SuSE
authorVincent Bernat <vincent@bernat.im>
Sat, 20 Feb 2016 17:53:27 +0000 (18:53 +0100)
committerVincent Bernat <vincent@bernat.im>
Sat, 20 Feb 2016 17:53:27 +0000 (18:53 +0100)
redhat/lldpd.spec

index 88e1b49bc3e82b29ebc8d81f19c40ee7dc0d49b5..216080654bd684fe1fecf89e5744d36c46ee5662 100644 (file)
@@ -71,12 +71,16 @@ BuildRequires: libxml2-devel
 BuildRequires: json-c-devel
 %endif
 %if %{with systemd}
+%if 0%{?suse_version}
+BuildRequires: systemd-rpm-macros
+%{?systemd_requires}
+%else
 Requires(post): systemd
 Requires(preun): systemd
 Requires(postun): systemd
-BuildRequires: systemd
 BuildRequires: systemd-units
 %endif
+%endif
 %if 0%{?suse_version}
 PreReq: %fillup_prereq %insserv_prereq pwdutils
 %else
@@ -212,10 +216,21 @@ if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
  %{_sbindir}/useradd -g %lldpd_group -M -r -s /sbin/nologin \
  -c "LLDP daemon" -d %lldpd_chroot %lldpd_user 2> /dev/null \
  || exit 1 ; fi
+%if 0%{?suse_version} >= 1210 && %{with systemd}
+%service_add_pre lldpd.service
+%endif
 
 %if 0%{?suse_version}
 # Service management for SuSE
 
+%if 0%{?suse_version} >= 1210 && %{with systemd}
+%post
+%service_add_post lldpd.service
+%preun
+%service_del_preun lldpd.service
+%postun
+%service_del_postun lldpd.service
+%else
 %post
 /sbin/ldconfig
 %{fillup_and_insserv lldpd}
@@ -225,6 +240,7 @@ if getent passwd %lldpd_user >/dev/null 2>&1 ; then : ; else \
 %insserv_cleanup
 %preun
 %stop_on_removal lldpd
+%endif
 
 %else
 %if %{without systemd}