[packages/mlocate] - cronjobs support added

matkor matkor at pld-linux.org
Tue Apr 4 11:46:09 CEST 2017


commit 88458c5d7ee8c76e99e409fce65c7c80bdaf4be8
Author: Mateusz Korniak <matkor at pld-linux.org>
Date:   Tue Apr 4 11:41:33 2017 +0200

    - cronjobs support added

 cronjob-mlocate.service | 11 +++++++++++
 cronjob-mlocate.timer   | 11 +++++++++++
 mlocate.spec            | 29 +++++++++++++++++++++++++++--
 3 files changed, 49 insertions(+), 2 deletions(-)
---
diff --git a/mlocate.spec b/mlocate.spec
index bf392ee..1992c64 100644
--- a/mlocate.spec
+++ b/mlocate.spec
@@ -1,14 +1,22 @@
+# TODO: 
+# - Add 
+#	nodevs=$(awk '$1 == "nodev" && $2 != "rootfs" { print $2 }' /proc/filesystems)
+#	exec /usr/bin/updatedb -f "$nodevs"
+#   to ExecStart=/usr/bin/updatedb
+
 Summary:	A locate/updatedb implementation
 Summary(pl.UTF-8):	Implementacja locate/updatedb
 Name:		mlocate
 Version:	0.26
-Release:	4
+Release:	5
 License:	GPL v2
 Group:		Applications/System
 Source0:	https://fedorahosted.org/releases/m/l/mlocate/%{name}-%{version}.tar.xz
 # Source0-md5:	539e6f86bf387358aa2b14d5f880e49a
 Source1:	updatedb.conf
 Source2:	%{name}.cron
+Source3:	cronjob-%{name}.timer
+Source4:	cronjob-%{name}.service
 URL:		https://fedorahosted.org/mlocate/
 BuildRequires:	rpmbuild(macros) >= 1.228
 BuildRequires:	tar >= 1:1.22
@@ -17,7 +25,9 @@ Requires(postun):	/usr/sbin/groupdel
 Requires(pre):	/usr/bin/getgid
 Requires(pre):	/usr/sbin/groupadd
 Requires:	awk
-Requires:	crondaemon
+Requires:	rc-scripts >= 0.4.2.4-2
+Requires:	systemd-units >= 38
+Suggests:	cronjobs
 Provides:	group(mlocate)
 Provides:	locate-utility
 Obsoletes:	locate-utility
@@ -59,6 +69,11 @@ cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/updatedb.conf
 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.daily/%{name}.cron
 touch $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/%{name}.db
 
+install -d  $RPM_BUILD_ROOT%{systemdunitdir}
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.timer
+install -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/cronjob-%{name}.service
+
+
 %find_lang %{name}
 
 %clean
@@ -71,11 +86,18 @@ rm -rf $RPM_BUILD_ROOT
 if [ ! -f %{_localstatedir}/lib/%{name}/%{name}.db ]; then
 	echo 'Run "%{_bindir}/updatedb" if you want to make %{name} database immediately.'
 fi
+%systemd_post cronjob-%{name}.timer
+
+%preun
+%systemd_preun cronjob-%{name}.timer
+
 
 %postun
 if [ "$1" = "0" ]; then
 	%groupremove %{name}
 fi
+%systemd_reload
+
 
 %files -f %{name}.lang
 %defattr(644,root,root,755)
@@ -90,3 +112,6 @@ fi
 %{_mandir}/man8/updatedb.8*
 %dir %attr(750,root,mlocate) /var/lib/%{name}
 %ghost %{_localstatedir}/lib/%{name}/%{name}.db
+%{systemdunitdir}/cronjob-%{name}.service
+%{systemdunitdir}/cronjob-%{name}.timer
+
diff --git a/cronjob-mlocate.service b/cronjob-mlocate.service
new file mode 100644
index 0000000..595d67f
--- /dev/null
+++ b/cronjob-mlocate.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=mlocate cronjob
+
+[Service]
+ExecStart=/usr/bin/updatedb
+Type=simple
+Nice=19
+IOSchedulingClass=2
+IOSchedulingPriority=7
+
+
diff --git a/cronjob-mlocate.timer b/cronjob-mlocate.timer
new file mode 100644
index 0000000..2b6ecc5
--- /dev/null
+++ b/cronjob-mlocate.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=mlocate cronjob timer
+
+[Timer]
+OnCalendar=*-*-* 03:49:00
+Persistent=True
+
+[Install]
+WantedBy=cronjobs.target
+
+# vi: ft=systemd
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mlocate.git/commitdiff/0ac7bfcb5b843bde7e1deb94dbe1e070a2e183b6



More information about the pld-cvs-commit mailing list