Browse Source

incron-0.5.12-5

git-svn-id: http://trac.vinelinux.org/repos/projects/specs@12460 ec354946-7b23-47d6-9f5a-488ba84defc7
tomop 3 years ago
parent
commit
bc1d029202
1 changed files with 59 additions and 20 deletions
  1. 59 20
      i/incron/incron-vl.spec

+ 59 - 20
i/incron/incron-vl.spec

@@ -1,25 +1,32 @@
-Summary:     Inotify cron system
-Name:        incron
-Version:     0.5.12
-Release:     4%{?_dist_release}
-
-Group:       System Environment/Base          
-License:     GPLv2
-URL:         https://github.com/ar-/incron
-Source0:     https://github.com/ar-/incron/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
-Source1:     incrond.init
-Patch0:      incron-0.5.10-gcc.patch
-Patch1:      incron-0.5.12-prevent-zombies.patch
+%bcond_with systemd
+
+Summary:        Inotify cron system
+Name:           incron
+Version:        0.5.12
+Release:        5%{?_dist_release}%{?with_systemd:.systemd}
+Group:          System Environment/Base
+Vendor:         Project Vine
+Distribution:   Vine Linux
+Packager:       tomop
+
+License:        GPLv2
+URL:            https://github.com/ar-/incron
+Source0:        https://github.com/ar-/incron/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
+Source1:        incrond.init
+Source2:        incrond.service
+Patch0:         incron-0.5.10-gcc.patch
+Patch1:         incron-0.5.12-prevent-zombies.patch
 # https://github.com/ar-/incron/pull/45/commits/134900ea1dd19834ba6e6c7e7e07611a0e0d78a0
-Patch2:      incron-fix-segv-on-mkdir.patch
-BuildRoot:   %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch2:         incron-fix-segv-on-mkdir.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+%if %{with systemd}
+%{?systemd_requires}
+%else
 Requires(post):   /sbin/chkconfig
 Requires(preun):  /sbin/chkconfig, /sbin/service
-
-Vendor: Project Vine
-Distribution: Vine Linux
-Packager: tomop
+Requires(postun): /sbin/service
+%endif
 
 %description
 This program is an "inotify cron" system.
@@ -34,6 +41,14 @@ filesystem events rather than time periods.
 %patch1 -p1 -b .zombie
 %patch2 -p1 -b .mkdir
 
+%if %{with systemd}
+sed -i -e 's|/var/run|/run|' \
+	appinst.h \
+	incron.conf.5 \
+	incron.conf.example \
+	incroncfg.cpp
+%endif
+
 %build
 make %{?_smp_mflags} CXXFLAGS="%{optflags}"
 
@@ -46,29 +61,46 @@ install -D -p incrond %{buildroot}%{_sbindir}/incrond
 install -D -p -m 4755 incrontab %{buildroot}%{_bindir}/incrontab
 install -d %{buildroot}%{_localstatedir}/spool/%{name}
 install -d %{buildroot}%{_sysconfdir}/%{name}.d
-install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initdir}/incrond
 install -D -p -m 0644 incron.conf.example %{buildroot}%{_sysconfdir}/%{name}.conf
 
+%if %{with systemd}
+install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/incrond.service
+%else
+install -D -p -m 0755 %{SOURCE1} %{buildroot}%{_initdir}/incrond
+%endif
+
 # install manpages
 make install-man MANPATH="%{buildroot}%{_mandir}" INSTALL="install -D -p"
 
 %post
+%if %{with systemd}
+%systemd_post incrond.service
+%else
 if [ $1 -eq 1 ]; then
     /sbin/chkconfig --add incrond
 fi
+%endif
 
 
 %preun
+%if %{with systemd}
+%systemd_preun incrond.service
+%else
 if [ $1 -eq 0 ]; then
         /sbin/service %{name} stop >/dev/null 2>&1 || :
         /sbin/chkconfig --del incrond
 fi
+%endif
 
 
 %postun
+%if %{with systemd}
+%systemd_postun_with_restart incrond.service
+%else
 if [ $1 -ge 1 ]; then
         /sbin/service incrond condrestart >/dev/null 2>&1 || :
 fi
+%endif
 
 
 %clean
@@ -80,7 +112,11 @@ rm -rf %{buildroot}
 %doc CHANGELOG README TODO
 %attr(4755,root,root) %{_bindir}/incrontab
 %{_sbindir}/incrond
+%if %{with systemd}
+%{_unitdir}/incrond.service
+%else
 %{_initdir}/incrond
+%endif
 %config(noreplace) %{_sysconfdir}/%{name}.conf
 %{_mandir}/man1/incrontab.1.gz
 %{_mandir}/man5/incrontab.5.gz
@@ -90,8 +126,11 @@ rm -rf %{buildroot}
 %dir %{_sysconfdir}/%{name}.d
 
 
-
 %changelog
+* Sun Apr 05 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.12-5
+- added R(postun):.
+- added systemd stuff (disabled as default).
+
 * Mon Dec 02 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.5.12-4
 - imported Patch2.