Browse Source

updated 5 packages

gnutls-3.6.13-1

keepalived-2.0.20-1

nsd-4.3.0-2

samba-4.12.1-1

zabbix-4.0.19-1

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12366 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 4 years ago
parent
commit
e7354da874
5 changed files with 467 additions and 99 deletions
  1. 9 2
      g/gnutls/gnutls-vl.spec
  2. 40 2
      k/keepalived/keepalived-vl.spec
  3. 94 21
      n/nsd/nsd-vl.spec
  4. 135 24
      s/samba/samba-vl.spec
  5. 189 50
      z/zabbix/zabbix-vl.spec

+ 9 - 2
g/gnutls/gnutls-vl.spec

@@ -1,14 +1,16 @@
 %define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
 %global guile_shortver %(guile-config --version 2>&1 | sed -e 's/^guile-config.*version //' -e ' s/\.[0-9]*$//')
 
+%global __provides_exclude_from ^%{_libdir}/pkgconfig/.*$
+
 Summary:	GNU TLS Library
 Summary(ja):	GNU TLS ライブラリ
 Name:		gnutls
-Version:	3.6.9
+Version:	3.6.13
 Release:	1%{?_dist_release}
-License:	GPLv3+ and LGPLv2+
 # The libgnutls library is LGPLv2+, utilities and remaining libraries are GPLv3+
 Group:		System Environment/Libraries
+License:	GPLv3+ and LGPLv2+
 URL:		http://www.gnutls.org/
 %global		shortver %(echo "%{version}" | sed -e 's/\.[0-9]*$//')
 Source0:	https://www.gnupg.org/ftp/gcrypt/gnutls/v%{shortver}/%{name}-%{version}.tar.xz
@@ -60,6 +62,8 @@ Group:		Development/Libraries
 Requires:	%{name} = %{version}-%{release}
 Requires:	libgcrypt-devel, zlib-devel, pkgconfig
 Requires:	libtasn1-devel, nettle-devel
+Provides:	pkgconfig(gnutls) = %{version}
+Provides:	pkgconfig(gnutls-dane) = %{version}
 Requires(post,preun): /sbin/install-info
 
 %description devel
@@ -293,6 +297,9 @@ fi
 %endif
 
 %changelog
+* Tue Apr 07 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6.13-1
+- new upstream release.
+
 * Wed Sep 11 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6.9-1
 - new upstream release.
 

+ 40 - 2
k/keepalived/keepalived-vl.spec

@@ -1,7 +1,9 @@
+%bcond_with systemd
+
 Summary: HA monitor built upon LVS, VRRP and services poller
 Name: keepalived
-Version: 2.0.18
-Release: 1%{?_dist_release}
+Version: 2.0.20
+Release: 1%{?_dist_release}%{?with_systemd:.systemd}
 License: GPL
 Group: Applications/System
 URL: http://www.keepalived.org/
@@ -10,6 +12,7 @@ Vendor: Project Vine
 Distribution: Vine Linux
 
 Source0: https://www.keepalived.org/software/keepalived-%{version}.tar.gz
+Source1: keepalived.service
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: openssl-devel
@@ -19,9 +22,14 @@ BuildRequires: iptables-devel
 BuildRequires: libnfnetlink-devel
 BuildRequires: net-snmp-devel
 
+%if %{with systemd}
+BuildRequires: systemd-units
+%{?systemd_requires}
+%else
 Requires(post): /sbin/chkconfig
 Requires(preun): /sbin/service, /sbin/chkconfig
 Requires(postun): /sbin/service
+%endif
 
 %description
 The main goal of the keepalived project is to add a strong & robust keepalive
@@ -42,7 +50,11 @@ healthchecks and LVS directors failover.
 
 %build
 %configure \
+%if %{with systemd}
+        --with-init=systemd \
+%else
         --with-init=SYSV \
+%endif
         --enable-snmp  --enable-snmp-rfc \
         --enable-sha1
 %{__make} %{?_smp_mflags} STRIP=/bin/true
@@ -59,23 +71,41 @@ healthchecks and LVS directors failover.
 
 mkdir -p %{buildroot}%{_libexecdir}/keepalived
 
+%if %{with systemd}
+rm -rf %{buildroot}%{_initrddir}/
+%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/keepalived.service
+%endif
+
+
 %clean
 %{__rm} -rf %{buildroot}
 
 
 %post
+%if %{with systemd}
+%systemd_post keepalived.service
+%else
 /sbin/chkconfig --add keepalived
+%endif
 
 %preun
+%if %{with systemd}
+%systemd_preun keepalived.service
+%else
 if [ $1 -eq 0 ]; then
     /sbin/service keepalived stop &>/dev/null || :
     /sbin/chkconfig --del keepalived
 fi
+%endif
 
 %postun
+%if %{with systemd}
+%systemd_postun_with_restart keepalived.service
+%else
 if [ $1 -ge 1 ]; then
     /sbin/service keepalived condrestart &>/dev/null || :
 fi
+%endif
 
 
 %files
@@ -87,7 +117,11 @@ fi
 %attr(0755,root,root) %{_sbindir}/keepalived
 %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/keepalived/keepalived.conf
 %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/sysconfig/keepalived
+%if %{with systemd}
+%{_unitdir}/keepalived.service
+%else
 %{_sysconfdir}/rc.d/init.d/keepalived
+%endif
 %dir %{_sysconfdir}/keepalived/
 %dir %{_libexecdir}/keepalived/
 %{_datadir}/snmp/mibs/*
@@ -96,6 +130,10 @@ fi
 %{_mandir}/man8/keepalived.8*
 
 %changelog
+* Sun Apr 05 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.20-1
+- new upstream release.
+- added systemd stuff (disabled as default).
+
 * Sun Sep 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.0.18-1
 - new upstream release.
 

+ 94 - 21
n/nsd/nsd-vl.spec

@@ -1,21 +1,37 @@
+%bcond_with systemd
+
 Summary: Fast and lean authoritative DNS Name Server
 Summary(ja): 高速で最小限のAuthoritative専用DNSネームサーバ
 Name: nsd
-Version: 4.2.4
-Release: 1%{?_dist_release}
+Version: 4.3.0
+Release: 2%{?_dist_release}%{?with_systemd:.systemd}
+Group: System Environment/Daemons
+Vendor: Project Vine
+Distribution: Vine Linux
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
 License: BSD
 Url: http://www.nlnetlabs.nl/%{name}/
-Source: http://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz
+Source: https://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz
 Source1: nsd.init
 Source3: nsd.sysconfig
-Patch0: nsd-4.1.10-config.patch
-Group: System Environment/Daemons
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-Vendor: Project Vine
-Distribution: Vine Linux
+Source10: nsd.service
+Source11: nsd-keygen.service
+Source12: tmpfiles-nsd.conf
 
 BuildRequires: flex, libevent-devel, openssl-devel
 Requires(pre): shadow-utils
+%if %{with systemd}
+%global piddir /run/%{name}
+BuildRequires: systemd-devel
+%{?systemd_requires}
+%else
+%global piddir %{_localstatedir}/run/%{name}
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+%endif
 
 %description
 NSD is a complete implementation of an authoritative DNS name server.
@@ -28,26 +44,36 @@ NSD に関する詳しい情報は REQUIREMENTS ドキュメントを参照し
 
 %prep
 %setup -q
+autoreconf
 
-%patch0 -p1
 
 %build
 %configure \
 	--with-configdir=%{_sysconfdir}/nsd \
 	--with-nsd_conf_file=%{_sysconfdir}/nsd/nsd.conf \
 	--with-zonesdir=%{_sysconfdir}/nsd \
-	--with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \
-	--with-dbfile=%{_localstatedir}/lib/%{name}/nsd.db \
-	--with-difffile=%{_localstatedir}/lib/%{name}/ixfr.db \
-	--with-xfrdfile=%{_localstatedir}/lib/%{name}/ixfr.state \
-	--with-max-ips=1024 \
+	--with-pidfile=%{piddir}/%{name}/%{name}.pid \
+    --with-zonelistfile=%{_sharedstatedir}/nsd/zone.list \
 	--with-ssl \
 	--with-user=nsd \
+	--with-xfrdfile=%{_localstatedir}/lib/%{name}/ixfr.state \
+	--with-max-ips=1024 \
+	--with-dbfile="" \
 	--enable-bind8-stats \
+	--enable-zone-stats \
 	--enable-checking \
 	--enable-mmap \
 	--enable-nsec3 \
-	--enable-ratelimit
+	--enable-ratelimit \
+	--enable-pie \
+	--enable-relro-now \
+	--enable-recvmmsg \
+	--enable-packed \
+	--enable-memclean \
+%if %{with systemd}
+	--enable-systemd \
+%endif
+	%{nil}
 
 %{__make} %{?_smp_mflags}
 #convert to utf8
@@ -60,15 +86,32 @@ mv -f doc/CREDITS.utf8 doc/CREDITS
 %install
 rm -rf %{buildroot}
 %{__make} DESTDIR=%{buildroot} install
-install -d -m 0755 %{buildroot}%{_initrddir}
-install -m 0755 %{SOURCE1} %{buildroot}/%{_initrddir}/nsd
 install -d -m 0700 %{buildroot}%{_localstatedir}/run/%{name}
 install -d -m 0700 %{buildroot}%{_localstatedir}/lib/%{name}
+
+%if %{with systemd}
+mkdir -p %{buildroot}%{_unitdir}
+install -m 0644 %{SOURCE10} %{SOURCE11} %{buildroot}%{_unitdir}
+mkdir -p %{buildroot}%{_tmpfilesdir}
+install -m 0644 %{SOURCE12} %{buildroot}%{_tmpfilesdir}/nsd.conf
+%else
+install -d -m 0755 %{buildroot}%{_initrddir}
+install -m 0755 %{SOURCE1} %{buildroot}/%{_initrddir}/nsd
 install -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig
 install -m 0755 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sysconfig/%{name}
+%endif
 
 # change .sample to normal config files
 mv %{buildroot}%{_sysconfdir}/nsd/nsd.conf.sample %{buildroot}%{_sysconfdir}/nsd/nsd.conf
+sed -i \
+	-e 's/# database:.*$/database: ""/' \
+	-e 's/# round-robin:.*$/round-robin: yes/' \
+	-e 's/# minimal-responses:.*$/minimal-responses: yes/' \
+	-e 's/# refuse-any:.*$/refuse-any: yes/' \
+	-e 's/# control-enable:.*$/control-enable: yes/' \
+	-e 's|# control-interface: ::1|control-interface: %{piddir}/nsd.ctl|' \
+	%{buildroot}%{_sysconfdir}/nsd/nsd.conf
+
 
 %clean
 rm -rf ${RPM_BUILD_ROOT}
@@ -80,8 +123,14 @@ rm -rf ${RPM_BUILD_ROOT}
 %dir %{_sysconfdir}/nsd/
 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.conf
 #%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/nsd/nsd.zones
+%if %{with systemd}
+%attr(0644,root,root) %{_unitdir}/nsd.service
+%attr(0644,root,root) %{_unitdir}/nsd-keygen.service
+%attr(0644,root,root) %{_tmpfilesdir}/nsd.conf
+%else
 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/nsd
 %attr(0755,root,root) %{_initrddir}/%{name}
+%endif
 %ghost %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}
 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/lib/%{name}
 %{_sbindir}/*
@@ -95,25 +144,49 @@ useradd -r -g nsd -d /etc/nsd -s /sbin/nologin \
 exit 0
 
 %post
-/sbin/chkconfig --add %{name}
 chown -R nsd.nsd %{_localstatedir}/lib/nsd 2>/dev/null ||:
 chown -R nsd.nsd %{_localstatedir}/run/nsd 2>/dev/null ||:
+%if %{with systemd}
+%systemd_post nsd.service
+%systemd_post nsd-keygen.service
+%else
+/sbin/chkconfig --add %{name}
 if [ ! -f %{_sysconfdir}/nsd/nsd_control.pem ]; then
   /usr/sbin/nsd-control-setup
 fi
+%endif
 
 %preun
-if [ $1 -eq 0 ]; then
-        /sbin/service %{name} stop 
-        /sbin/chkconfig --del %{name} 
+%if %{with systemd}
+%systemd_preun nsd.service
+%systemd_preun nsd-keygen.service
+%else
+if [ $1 -eq 0 -o -x /bin/systemctl ]; then
+        /sbin/service %{name} stop
+        /sbin/chkconfig --del %{name}
 fi
+%endif
 
 %postun
+%if %{with systemd}
+%systemd_postun_with_restart nsd.service
+%systemd_postun nsd-keygen.service
+%else
 if [ "$1" -ge "1" ]; then
   /sbin/service %{name} condrestart 
 fi
+%endif
 
 %changelog
+* Tue Apr 07 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.3.0-2
+- fixed nsd-keygen.service.
+- updated nsd.conf.
+
+* Mon Apr 06 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.3.0-1
+- new upstream release.
+- dropped Patch0.
+- added systemd support (disabled as default).
+
 * Mon Dec 16 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.2.4-1
 - new upstream release.
 

+ 135 - 24
s/samba/samba-vl.spec

@@ -1,8 +1,9 @@
+%bcond_with systemd
 %bcond_without pidl
 
-%define samba_version 4.12.0
+%define samba_version 4.12.1
 #define rc_number rc4
-%define samba_release 2
+%define samba_release 1
 
 %define doc_version 4.12.0
 %define api_version 4.0
@@ -37,7 +38,7 @@ Summary: The Samba Suite of programs
 Summary(ja): Samba スイート
 Name: samba
 Version: %{samba_version}
-Release: %{samba_release}%{?rc_suffix}%{?_dist_release}
+Release: %{samba_release}%{?rc_suffix}%{?_dist_release}%{?with_systemd:.systemd}
 License: GPLv3+
 Group: System Environment/Daemons
 URL: http://www.samba.org/
@@ -79,9 +80,16 @@ Obsoletes: ctdb <= 2.5.5
 Obsoletes: samba-pidl < %{version}-%{release}
 %endif
 
-BuildRoot: %{_tmppath}/%{name}-%{samba_version}-%{release}-root
+%if %{with systemd}
+BuildRequires: systemd-devel
+%{?systemd_requires}
+%else
 Requires(post): /sbin/chkconfig, /sbin/service
 Requires(preun): /sbin/chkconfig, /sbin/service
+Requires(postun): /sbin/chkconfig, /sbin/service
+%endif
+
+BuildRoot: %{_tmppath}/%{name}-%{samba_version}-%{release}-root
 
 BuildRequires: avahi-devel
 BuildRequires: bison
@@ -276,8 +284,13 @@ Conflicts: samba-winbind < %{samba_version}
 Provides: samba-winbind = %{samba_version}
 Requires: samba-common = %{samba_version}-%{release}
 Requires(pre): /usr/sbin/groupadd
+%if %{with systemd}
+%{?systemd_requires}
+%else
 Requires(post): /sbin/chkconfig, /sbin/service, coreutils
 Requires(preun): /sbin/chkconfig, /sbin/service
+Requires(postun): /sbin/chkconfig, /sbin/service
+%endif
 
 %description winbind
 The samba-winbind package provides the winbind daemon, a NSS library, a PAM
@@ -377,7 +390,14 @@ Requires: %{name}-winbind = %{samba_version}-%{release}
 Requires: %{name}-client = %{samba_version}-%{release}
 Requires: %{name}-python = %{samba_version}-%{release}
 Requires: python3-dns
-Requires(post): /sbin/chkconfig, /sbin/service, acl
+Requires(post): acl
+%if %{with systemd}
+%{?systemd_requires}
+%else
+Requires(post): /sbin/chkconfig, /sbin/service
+Requires(preun): /sbin/chkconfig, /sbin/service
+Requires(postun): /sbin/chkconfig, /sbin/service
+%endif
 
 %description dc
 The %{name}-dc package provides AD Domain Controller functionality
@@ -504,10 +524,19 @@ LDFLAGS="-Wl,-z,relro,-z,now" \
   --with-logfilebase=/var/log/samba \
   --with-modulesdir=%{_libdir}/samba \
   --with-pammodulesdir=/%{_lib}/security \
-  --with-piddir=/var/run/samba \
   --with-privatedir=/var/lib/samba/private \
+  --without-ldb-lmdb \
+%if %{with systemd}
+  --with-systemd \
+  --systemd-install-services \
+  --with-systemddir=%{_unitdir} \
+  --with-piddir=/run/samba \
+  --with-sockets-dir=/run/samba \
+%else
+  --with-piddir=/var/run/samba \
   --with-sockets-dir=/var/run/samba \
-  --without-ldb-lmdb
+%endif
+  %{nil}
 
 #  --bundled-libraries=NONE \
 #  --with-system-mitkrb5 \
@@ -567,11 +596,17 @@ install -d -m 0755 %{buildroot}/var/spool/samba
 install -d -m 0755 %{buildroot}/%{_libdir}/samba
 install -d -m 0755 %{buildroot}/%{_libdir}/pkgconfig
 
+%if %{with systemd}
+install -d -m 0755 %{buildroot}%{_tmpfilesdir}
+# Create /run/samba.
+echo "d /run/samba  755 root root" > %{buildroot}%{_tmpfilesdir}/samba.conf
+%else
 # initscripts
 install -m755 %{SOURCE100} %{buildroot}%{_initrddir}/nmb
 install -m755 %{SOURCE101} %{buildroot}%{_initrddir}/smb
 install -m755 %{SOURCE102} %{buildroot}%{_initrddir}/winbind
 install -m755 samba4.init %{buildroot}%{_initrddir}/samba
+%endif
 
 # pam
 install -m644 %{SOURCE6} %{buildroot}%{_sysconfdir}/pam.d/samba
@@ -658,21 +693,25 @@ fi
 
 ## ====================================================================
 %post
+%if %{with systemd}
+%systemd_post smb.service
+%systemd_post nmb.service
+%else
 if [ $1 -eq 1 ]; then   # Install
   # chkconfig
   /sbin/chkconfig --add smb
   /sbin/chkconfig --add nmb
 fi
-
-if [ $1 -ge 2 ]; then   # Upgrade
-  /sbin/service smb condrestart >/dev/null 2>&1 || :
-  /sbin/service nmb condrestart >/dev/null 2>&1 || :
-fi
 exit 0
+%endif
 
 ## --------------------------------------------------------------------
 %preun
-if [ $1 = 0 ] ; then
+%if %{with systemd}
+%systemd_preun smb.service
+%systemd_preun nmb.service
+%else
+if [ $1 = 0 -o -x /sbin/systemctl ] ; then
   /sbin/service smb stop >/dev/null 2>&1 || :
   /sbin/service nmb stop >/dev/null 2>&1 || :
   /sbin/service samba stop >/dev/null 2>&1 || :
@@ -682,6 +721,19 @@ if [ $1 = 0 ] ; then
   # rm -rf /var/log/samba/* /var/lib/samba/*
 fi
 exit 0
+%endif
+
+## --------------------------------------------------------------------
+%postun
+%if %{with systemd}
+%systemd_postun_with_restart smb.service
+%systemd_postun_with_restart nmb.service
+%else
+if [ $1 -ge 0 ]; then   # Upgrade
+  /sbin/service smb condrestart >/dev/null 2>&1 || :
+  /sbin/service nmb condrestart >/dev/null 2>&1 || :
+fi
+%endif
 
 ## --------------------------------------------------------------------
 %pre winbind
@@ -689,15 +741,36 @@ exit 0
 
 ## --------------------------------------------------------------------
 %post winbind
+%if %{with systemd}
+%systemd_post winbind.service
+%else
 /sbin/chkconfig --add winbind
+%endif
+
+## --------------------------------------------------------------------
+%preun winbind
+%if %{with systemd}
+%systemd_preun winbind.service
+%else
+if [ $1 = 0 -o -x /sbin/systemctl ] ; then
+    /sbin/service winbind stop >/dev/null 2>&1 || :
+    /sbin/chkconfig --del winbind
+fi
+exit 0
+%endif
 
-if [ "$1" -ge "1" ]; then
+## --------------------------------------------------------------------
+%postun winbind
+%if %{with systemd}
+%systemd_postun_with_restart winbind.service
+%else
+%endif
+if [ "$1" -ge 0 ]; then
 	/sbin/service winbind condrestart >/dev/null 2>&1 || :
 fi
 
 ## --------------------------------------------------------------------
 %post dc
-
 if [ $1 -eq 1 ]; then   # Install
   # modify named.conf.dlz for DLZ configuration if version 9.9.0 or later
   if [ -f /usr/sbin/named ]; then
@@ -710,7 +783,9 @@ if [ $1 -eq 1 ]; then   # Install
     fi
   fi
 
+%if !%{with systemd}
   /sbin/chkconfig --add samba
+%endif
 
   # rename original smb.conf for provisioning
   if [ -f /etc/samba/smb.conf ]; then
@@ -726,12 +801,31 @@ fi
 if [ -f /var/lib/samba/private/tls/key.pem ]; then
   chmod 0600 /var/lib/samba/private/tls/key.pem
 fi
+%if %{with systemd}
+%systemd_post samba.service
+%endif
 
-if [ $1 -ge 2 ]; then   # Upgrade
+%preun dc
+%if %{with systemd}
+%systemd_preun samba.service
+%else
+if [ $1 = 0 -o -x /sbin/systemctl ] ; then
+    /sbin/service samba stop >/dev/null 2>&1 || :
+    /sbin/chkconfig --del samba
+fi
+exit 0
+%endif
+
+%postun dc
+%if %{with systemd}
+%systemd_postun_with_restart samba.service
+%else
+if [ $1 -ge 0 ]; then   # Upgrade
   if [ -f /var/run/samba/samba.pid ]; then
     /sbin/service samba restart >/dev/null 2>&1 || :
   fi
 fi
+%endif
 
 ## --------------------------------------------------------------------
 %post common
@@ -739,13 +833,9 @@ fi
 
 setfacl -m u:named:rwx /var/lib/samba/private >/dev/null 2>/dev/null || :
 
-## --------------------------------------------------------------------
-%preun winbind
-if [ $1 = 0 ] ; then
-    /sbin/service winbind stop >/dev/null 2>&1 || :
-    /sbin/chkconfig --del winbind
-fi
-exit 0
+%if %{with systemd}
+%tmpfiles_create %{_tmpfilesdir}/samba.conf
+%endif
 
 ## --------------------------------------------------------------------
 %postun common
@@ -880,8 +970,13 @@ fi
 %attr(0700,root,root) %dir /var/log/samba
 %attr(0700,root,root) %dir /var/log/samba/old
 %attr(1777,root,root) %dir /var/spool/samba
+%if %{with systemd}
+%{_unitdir}/smb.service
+%{_unitdir}/nmb.service
+%else
 %{_initrddir}/nmb
 %{_initrddir}/smb
+%endif
 %{_datadir}/samba/mdssvc
 
 %{_mandir}/man1/ldbadd.1*
@@ -1165,6 +1260,9 @@ fi
 %dir /var/run/samba
 %dir /var/run/winbindd
 %dir /var/lib/samba
+%if %{with systemd}
+%{_tmpfilesdir}/samba.conf
+%endif
 %attr(700,root,root) %dir /var/lib/samba/private
 %attr(755,root,root) %dir /var/lib/samba/msg
 %attr(755,root,root) %dir %{_sysconfdir}/samba
@@ -1219,7 +1317,6 @@ fi
 %{_sbindir}/samba-gpupdate
 %{_sbindir}/samba_spnupdate
 %{_sbindir}/samba_upgradedns
-%{_initrddir}/samba
 %{_libdir}/samba/auth/samba4.so
 %{_libdir}/samba/bind9
 %{_libdir}/samba/gensec
@@ -1232,6 +1329,11 @@ fi
 %{_libdir}/samba/service
 %dir /var/lib/samba/sysvol
 %{_datadir}/samba/setup
+%if %{with systemd}
+%{_unitdir}/samba.service
+%else
+%{_initrddir}/samba
+%endif
 %{_mandir}/man8/samba.8*
 %{_mandir}/man8/samba-tool.8*
 %{_mandir}/man8/samba_downgrade_db.8.gz
@@ -1256,7 +1358,11 @@ fi
 %{_mandir}/man8/winbindd.8*
 %{_mandir}/man8/idmap_*.8*
 #%{_datadir}/locale/*/LC_MESSAGES/pam_winbind.mo
+%if %{with systemd}
+%{_unitdir}/winbind.service
+%else
 %{_initrddir}/winbind
+%endif
 # ja manuals
 %{_mandir}/ja/man5/pam_winbind.conf.5*
 %{_mandir}/ja/man8/winbindd.8*
@@ -1717,6 +1823,11 @@ fi
 %endif
 
 %changelog
+* Tue Apr 07 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.12.1-1
+- new upstream release.
+- added systemd support (disabled as default).
+- fixed %%post, %%preun and %%postun.
+
 * Tue Mar 31 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.12.0-2
 - re-enabled pidl.
 - enabled tracker/Spotlight support.

+ 189 - 50
z/zabbix/zabbix-vl.spec

@@ -1,5 +1,4 @@
-%define ver 4.0.15
-%define rel 1
+%bcond_with systemd
 
 %define only_agent 0
 
@@ -17,21 +16,35 @@
 
 Summary: The Enterprise-class Monitoring Solution for Everyone
 Name: zabbix
-Version: %{ver}
-Release: %{rel}%{?_dist_release}
-License: GPLv2
+Version: 4.0.19
+Release: 1%{?_dist_release}%{?with_systemd:.systemd}
 Group: Applications/Services
+Vendor: Project Vine
+Distribution: Vine Linux
+Packager: iwaim
+
+License: GPLv2
 URL: https://www.zabbix.com/
-Source0: https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/%{version}/%{name}-%{version}.tar.gz
+Source0: https://cdn.zabbix.com/stable/%{version}/%{name}-%{version}.tar.gz
 Source1: zabbix_server.init
 Source2: zabbix_proxy.init
 Source3: zabbix_agentd.init
 Source4: zabbix_server.logrotate
 Source5: zabbix_proxy.logrotate
 Source6: zabbix_agentd.logrotate
+
+Source9:        %{name}-tmpfiles-zabbix.conf
+# systemd units -- Alternatives switches between them (they state their dependencies)
+# https://support.zabbix.com/browse/ZBXNEXT-1593
+Source10:       %{name}-agent.service
+Source11:       %{name}-proxy-mysql.service
+Source12:       %{name}-proxy-pgsql.service
+Source14:       %{name}-server-mysql.service
+Source15:       %{name}-server-pgsql.service
+Source17:       %{name}-tmpfiles-zabbixsrv.conf
+
 Patch1: 0001-change-the-font-for-Vine-Linux.patch
 Patch2: 0002-modified-config-files-for-Vine-Linux.patch
-Patch3: zabbix-4.0.15-php74.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 %if %{with server}%{with proxy}
 BuildRequires: libpq-devel
@@ -46,10 +59,9 @@ BuildRequires: unixODBC-devel
 BuildRequires: libssh2-devel
 Requires(pre): glibc-common
 Requires(pre): shadow-utils
-
-Vendor: Project Vine
-Distribution: Vine Linux
-Packager: iwaim
+%if %{with systemd}
+BuildRequires:   systemd
+%endif
 
 %description
 The Enterprise-class Monitoring Solution for Everyone.
@@ -58,8 +70,12 @@ The Enterprise-class Monitoring Solution for Everyone.
 %package server-common
 Summary: common files for Zabbix Server
 Requires: %{name} == %{version}-%{release}
+%if %{with systemd}
+%{?systemd_requires}
+%else
 Requires(post,preun): chkconfig
 Requires(preun,postun): initscripts
+%endif
 
 %description server-common
 This package include common files for Zabbix Server.
@@ -86,8 +102,12 @@ Zabbix Server for PostgreSQL
 %package agent
 Summary: Zabbix Agent
 Requires: %{name} == %{version}-%{release}
+%if %{with systemd}
+%{?systemd_requires}
+%else
 Requires(post,preun): chkconfig
 Requires(preun,postun): initscripts
+%endif
 
 %description agent
 Zabbix Agent
@@ -98,8 +118,12 @@ Zabbix Agent
 %package proxy-common
 Summary: common files for Zabbix Proxy
 Requires: %{name} == %{version}-%{release}
+%if %{with systemd}
+%{?systemd_requires}
+%else
 Requires(post,preun): chkconfig
 Requires(preun,postun): initscripts
+%endif
 
 %description proxy-common
 This package include common files for Zabbix Proxy
@@ -126,7 +150,7 @@ Zabbix Proxy for PostgreSQL
 %package frontend-php
 Summary: Zabbix web frontend with PHP
 Group: Applications/Internet
-Requires: php5
+Requires: php74
 Requires: TrueType-vlgothic
 
 %description frontend-php
@@ -136,7 +160,7 @@ Zabbix web frontend with PHP.
 Summary: Zabbix web frontend with PHP and MySQL/MariaDB
 Group: Applications/Internet
 Provides: %{name}-frontend-php == %{version}-%{release}
-Requires: php5-mysql
+Requires: php74-mysql
 
 %description frontend-php-mysql
 Zabbix web frontend with PHP and MySQL/MariaDB.
@@ -145,7 +169,7 @@ Zabbix web frontend with PHP and MySQL/MariaDB.
 Summary: Zabbix web frontend with PHP and PostgreSQL
 Group: Applications/Internet
 Provides: %{name}-frontend-php == %{version}-%{release}
-Requires: php5-pgsql
+Requires: php74-pgsql
 
 %description frontend-php-postgresql
 Zabbix web frontend with PHP and PostgreSQL.
@@ -158,7 +182,6 @@ mv zabbix-%{version} zabbix_mysql
 pushd zabbix_mysql
 %patch1 -p 1
 %patch2 -p 1
-%patch3 -p 1
 popd
 
 %if %{with server}%{with proxy}
@@ -167,10 +190,32 @@ mv zabbix-%{version} zabbix_pgsql
 pushd zabbix_pgsql
 %patch1 -p 1
 %patch2 -p 1
-%patch3 -p 1
 popd
 %endif
 
+%if %{with systemd}
+# Specific
+for v in mysql pgsql; do
+pushd zabbix_$v
+sed -i \
+    -e '\|^# PidFile=.*|a PidFile=/run/zabbix/zabbix_agentd.pid' \
+    -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_agentd.log|' \
+    conf/zabbix_agentd.conf
+
+sed -i \
+    -e '\|^# PidFile=.*|a PidFile=/run/zabbix/zabbix_proxy.pid' \
+    -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_proxy.log|' \
+    conf/zabbix_proxy.conf
+
+sed -i \
+    -e '\|^# PidFile=.*|a PidFile=/run/zabbix/zabbix_server.pid' \
+    -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_server.log|' \
+    conf/zabbix_server.conf
+popd
+done
+
+%endif
+
 %build
 
 Build()
@@ -209,9 +254,9 @@ popd
 %endif
 
 %install
-%__rm -rf $RPM_BUILD_ROOT
+%__rm -rf %{buildroot}
 pushd zabbix_mysql
-make DESTDIR=$RPM_BUILD_ROOT install
+make DESTDIR=%{buildroot} install
 
 %if %{with server}
 mv -f %{buildroot}%{_sbindir}/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.mysql
@@ -221,47 +266,63 @@ mv -f %{buildroot}%{_sbindir}/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.
 %endif
 
 # make directories
-%__mkdir_p $RPM_BUILD_ROOT%{_localstatedir}/{log,run}/%{name}
+%__mkdir_p %{buildroot}%{_localstatedir}/{log,run}/%{name}
 
 # DB
-%__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix
+%__mkdir_p %{buildroot}%{_datadir}/zabbix
 %if %{with server}%{with proxy}
-%__cp -a database/postgresql $RPM_BUILD_ROOT%{_datadir}/zabbix/
-%__cp -a database/mysql $RPM_BUILD_ROOT%{_datadir}/zabbix/
+%__cp -a database/postgresql %{buildroot}%{_datadir}/zabbix/
+%__cp -a database/mysql %{buildroot}%{_datadir}/zabbix/
 %endif
 
+%if %{with systemd}
+# unit files
+%__mkdir_p %{buildroot}%{_unitdir}
+# Install different systemd units because of the requirements for DBMS daemons
+install -m 0644 -p %{SOURCE10} %{buildroot}%{_unitdir}/zabbix-agent.service
+install -m 0644 -p %{SOURCE11} %{buildroot}%{_unitdir}/zabbix-proxy-mysql.service
+install -m 0644 -p %{SOURCE12} %{buildroot}%{_unitdir}/zabbix-proxy-pgsql.service
+install -m 0644 -p %{SOURCE14} %{buildroot}%{_unitdir}/zabbix-server-mysql.service
+install -m 0644 -p %{SOURCE15} %{buildroot}%{_unitdir}/zabbix-server-pgsql.service
+
+# systemd tmpfiles
+mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
+install -m 0644 -p %{SOURCE9} %{buildroot}%{_prefix}/lib/tmpfiles.d/zabbix.conf
+
+%else
 # init.d
-%__mkdir_p $RPM_BUILD_ROOT%{_initddir}
+%__mkdir_p %{buildroot}%{_initddir}
 %if %{with server}
-%__cp %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/zabbix_server
+%__cp %{SOURCE1} %{buildroot}%{_initddir}/zabbix_server
 %endif
 %if %{with proxy}
-%__cp %{SOURCE2} $RPM_BUILD_ROOT%{_initddir}/zabbix_proxy
+%__cp %{SOURCE2} %{buildroot}%{_initddir}/zabbix_proxy
 %endif
 %if %{with agent}
-%__cp %{SOURCE3} $RPM_BUILD_ROOT%{_initddir}/zabbix_agentd
+%__cp %{SOURCE3} %{buildroot}%{_initddir}/zabbix_agentd
+%endif
 %endif
 
 # logrotate
-%__mkdir_p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
+%__mkdir_p %{buildroot}%{_sysconfdir}/logrotate.d
 %if %{with server}
-%__cp %{SOURCE4}  $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_server
+%__cp %{SOURCE4}  %{buildroot}%{_sysconfdir}/logrotate.d/zabbix_server
 %endif
 %if %{with proxy}
-%__cp %{SOURCE5}  $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_proxy
+%__cp %{SOURCE5}  %{buildroot}%{_sysconfdir}/logrotate.d/zabbix_proxy
 %endif
 %if %{with agent}
-%__cp %{SOURCE6}  $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_agentd
+%__cp %{SOURCE6}  %{buildroot}%{_sysconfdir}/logrotate.d/zabbix_agentd
 %endif
 
 %if %{with frontend}
 # frontend-php
-%__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend
-%__cp -a frontends/php $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/
-%__rm -f $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/assets/fonts/DejaVuSans.ttf
+%__mkdir_p %{buildroot}%{_datadir}/zabbix-frontend
+%__cp -a frontends/php %{buildroot}%{_datadir}/zabbix-frontend/
+%__rm -f %{buildroot}%{_datadir}/zabbix-frontend/php/assets/fonts/DejaVuSans.ttf
 
 ln -s /usr/share/fonts/TrueType-vlgothic/VL-Gothic-Regular.ttf \
-      $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/assets/fonts/
+      %{buildroot}%{_datadir}/zabbix-frontend/php/assets/fonts/
 %endif
 
 %if %{with proxy}
@@ -281,7 +342,7 @@ popd
 %endif
 
 %clean
-%__rm -rf $RPM_BUILD_ROOT
+%__rm -rf %{buildroot}
 
 %pre
 getent group zabbix >/dev/null || groupadd -r zabbix
@@ -292,115 +353,164 @@ exit 0
 
 %if %{with server}
 %post server-mysql
+%if %{with systemd}
+%systemd_post zabbix-server-mysql.service
+%else
 /sbin/update-alternatives --install /usr/sbin/zabbix_server \
         zabbix_server /usr/sbin/zabbix_server.mysql 10
-
-/sbin/chkconfig --add zabbix_server
+%endif
 
 %post server-postgresql
+%if %{with systemd}
+%systemd_post zabbix-server-pgsql.service
+%else
 /sbin/update-alternatives --install /usr/sbin/zabbix_server \
         zabbix_server /usr/sbin/zabbix_server.pgsql 10
-
 /sbin/chkconfig --add zabbix_server
-
+%endif
 %endif
 
 %if %{with proxy}
 %post proxy-mysql
+%if %{with systemd}
+%systemd_post zabbix-proxy-mysql.service
+%else
 /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
         zabbix_proxy /usr/sbin/zabbix_proxy.mysql 10
-
 /sbin/chkconfig --add zabbix_proxy
+%endif
 
 %post proxy-postgresql
+%if %{with systemd}
+%systemd_post zabbix-proxy-pgsql.service
+%else
 /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
         zabbix_proxy /usr/sbin/zabbix_proxy.pgsql 10
-
 /sbin/chkconfig --add zabbix_proxy
-
+%endif
 %endif
 
 %if %{with agent}
 %post agent
+%if %{with systemd}
+%systemd_post zabbix-agent.service
+%else
 /sbin/chkconfig --add zabbix_agentd
+%endif
 
 %endif
 
 %if %{with server}
 %preun server-mysql
-if [ "$1" -eq 0 ]; then
+%if %{with systemd}
+%systemd_preun zabbix-server-mysql.service
+%else
+if [ "$1" -eq 0 -o -x /bin/systemctl ]; then
         /sbin/service zabbix_server stop >/dev/null 2>&1
         /sbin/chkconfig --del zabbix_server
         /sbin/update-alternatives --remove zabbix_server \
                 /usr/sbin/zabbix_server.mysql
 fi
+%endif
 
 %preun server-postgresql
-if [ "$1" -eq 0 ]; then
+%if %{with systemd}
+%systemd_preun zabbix-server-pgysql.service
+%else
+if [ "$1" -eq 0 -o -x /bin/systemctl ]; then
         /sbin/service zabbix_server stop >/dev/null 2>&1
         /sbin/chkconfig --del zabbix_server
         /sbin/update-alternatives --remove zabbix_server \
                 /usr/sbin/zabbix_server.pgsql
 fi
-
+%endif
 %endif
 
 %if %{with proxy}
 %preun proxy-mysql
-if [ "$1" -eq 0 ]; then
+%if %{with systemd}
+%systemd_preun zabbix-proxy-mysql.service
+%else
+if [ "$1" -eq 0 -o -x /bin/systemctl ]; then
         /sbin/service zabbix_proxy stop >/dev/null 2>&1
         /sbin/chkconfig --del zabbix_proxy
         /sbin/update-alternatives --remove zabbix_proxy \
                 /usr/sbin/zabbix_proxy.mysql
 fi
+%endif
 
 %preun proxy-postgresql
-if [ "$1" -eq 0 ]; then
+%if %{with systemd}
+%systemd_preun zabbix-proxy-pgsql.service
+%else
+if [ "$1" -eq 0 -o -x /bin/systemctl ]; then
         /sbin/service zabbix_proxy stop >/dev/null 2>&1
         /sbin/chkconfig --del zabbix_proxy
         /sbin/update-alternatives --remove zabbix_proxy \
                 /usr/sbin/zabbix_proxy.pgsql
 fi
-
+%endif
 %endif
 
 %if %{with agent}
 %preun agent
+%systemd_preun zabbix-agent.service
+%if %{with systemd}
+%else
 if [ "$1" -eq 0 ]; then
         /sbin/service zabbix_agentd stop >/dev/null 2>&1
         /sbin/chkconfig --del zabbix_agentd
 fi
-
+%endif
 %endif
 
 %if %{with server}
 %postun server-mysql
+%if %{with systemd}
+%systemd_postun_with_restart zabbix-server-mysql.service
+%else
 if [ "$1" -ge "1" ]; then
         /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
 fi
+%endif
 
 %postun server-postgresql
+%if %{with systemd}
+%systemd_postun_with_restart zabbix-server-pgsql.service
+%else
 if [ "$1" -ge "1" ]; then
         /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
 fi
-
+%endif
 %endif
 
 %if %{with proxy}
 %postun proxy-mysql
+%if %{with systemd}
+%systemd_postun_with_restart zabbix-proxy-mysql.service
+%else
 if [ "$1" -ge "1" ]; then
         /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
 fi
+%endif
 
 %postun proxy-postgresql
+%if %{with systemd}
+%systemd_postun_with_restart zabbix-proxy-pgsql.service
+%else
 if [ "$1" -ge "1" ]; then
         /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
 fi
+%endif
 
 %postun agent
+%if %{with systemd}
+%systemd_postun_with_restart zabbix-agent.service
+%else
 if [ "$1" -ge "1" ]; then
         /sbin/service zabbix_agentd condrestart >/dev/null 2>&1 || :
 fi
+%endif
 
 %endif
 
@@ -415,6 +525,9 @@ fi
 %{_datadir}/zabbix/mysql
 %{_datadir}/zabbix/postgresql
 %endif
+%if %{with systemd}
+%{_prefix}/lib/tmpfiles.d/zabbix.conf
+%endif
 
 %if %{with server}
 %files server-common
@@ -422,16 +535,24 @@ fi
 %dir %{_sysconfdir}/zabbix
 %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_server
+%if !%{with systemd}
 %{_initddir}/zabbix_server*
+%endif
 %{_mandir}/man8/zabbix_server.8*
 
 %files server-mysql
 %defattr(-,root,root,-)
 %{_sbindir}/zabbix_server.mysql
+%if %{with systemd}
+%{_unitdir}/zabbix-server-mysql.service
+%endif
 
 %files server-postgresql
 %defattr(-,root,root,-)
 %{_sbindir}/zabbix_server.pgsql
+%if %{with systemd}
+%{_unitdir}/zabbix-server-pgsql.service
+%endif
 
 %endif
 
@@ -444,7 +565,11 @@ fi
 %{_bindir}/zabbix_get
 %{_bindir}/zabbix_sender
 %{_sbindir}/zabbix_agentd
+%if %{with systemd}
+%{_unitdir}/zabbix-agent.service
+%else
 %{_initddir}/zabbix_agentd
+%endif
 %{_mandir}/man1/zabbix_get.1*
 %{_mandir}/man1/zabbix_sender.1*
 %{_mandir}/man8/zabbix_agentd.8*
@@ -457,17 +582,25 @@ fi
 %dir %{_sysconfdir}/zabbix
 %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_proxy
+%if !%{with systemd}
 %{_initddir}/zabbix_proxy
+%endif
 %{_mandir}/man8/zabbix_proxy.8*
 %{_datadir}/zabbix-proxy
 
 %files proxy-mysql
 %defattr(-,root,root,-)
 %{_sbindir}/zabbix_proxy.mysql
+%if %{with systemd}
+%{_unitdir}/zabbix-proxy-mysql.service
+%endif
 
 %files proxy-postgresql
 %defattr(-,root,root,-)
 %{_sbindir}/zabbix_proxy.pgsql
+%if %{with systemd}
+%{_unitdir}/zabbix-proxy-pgsql.service
+%endif
 
 %endif
 
@@ -486,6 +619,12 @@ fi
 %endif
 
 %changelog
+* Mon Apr 06 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.0.19-1
+- new upstream release.
+- dropped Patch3: fixed in upstream.
+- changed R:php5 to R:php74.
+- added systemd support (disabled as default).
+
 * Thu Dec 19 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.0.15-1
 - new upstream release.
 - imported Patch13 from upstream to support php74.