+# 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
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
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
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)
%{_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
+