commit 71140e93ae9811bd21bb7706ef5053126b95fd3b Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:04:38 2019 -0400 Package init diff --git a/mlocate-0.26.tar.xz b/mlocate-0.26.tar.xz new file mode 100644 index 0000000..315d5f3 Binary files /dev/null and b/mlocate-0.26.tar.xz differ diff --git a/mlocate-run-updatedb b/mlocate-run-updatedb new file mode 100644 index 0000000..7d3f2ac --- /dev/null +++ b/mlocate-run-updatedb @@ -0,0 +1,4 @@ +#!/bin/sh + +nodevs=$(< /proc/filesystems awk '$1 == "nodev" && $2 != "rootfs" && $2 != "zfs" { print $2 }') +/usr/bin/updatedb -f "$nodevs" diff --git a/mlocate-updatedb.service b/mlocate-updatedb.service new file mode 100644 index 0000000..46efbd3 --- /dev/null +++ b/mlocate-updatedb.service @@ -0,0 +1,13 @@ +[Unit] +Description=Update a database for mlocate + +[Service] +ExecStart=/usr/libexec/mlocate-run-updatedb +Nice=19 +IOSchedulingClass=2 +IOSchedulingPriority=7 + +PrivateTmp=true +PrivateDevices=true +PrivateNetwork=true +ProtectSystem=true diff --git a/mlocate-updatedb.timer b/mlocate-updatedb.timer new file mode 100644 index 0000000..9472537 --- /dev/null +++ b/mlocate-updatedb.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Updates mlocate database every day + +[Timer] +OnCalendar=daily +AccuracySec=24h +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/mlocate.spec b/mlocate.spec new file mode 100644 index 0000000..18b958f --- /dev/null +++ b/mlocate.spec @@ -0,0 +1,88 @@ +%global _hardened_build 1 + +Name: mlocate +Version: 0.26 +Release: 23 +Summary: Application of finding files by name +License: GPLv2 +URL: https://fedorahosted.org/mlocate/ +Source0: https://fedorahosted.org/releases/m/l/mlocate/mlocate-%{version}.tar.xz +Source1: updatedb.conf +Source2: mlocate-run-updatedb +Source3: mlocate-updatedb.service +Source4: mlocate-updatedb.timer + +BuildRequires: gcc systemd +Requires(pre): shadow-utils +Requires(post): grep sed +# standard systemd requires +%{?systemd_requires} +Provides: bundled(gnulib) +Obsoletes: slocate <= 2.7-30 + +%description +mlocate is a locate/updatedb implementation. The 'm' stands for "merging": +updatedb reuses the existing database to avoid rereading most of the file +system, which makes updatedb faster and does not trash the system caches as +much. + +%package_help + +%prep +%autosetup -n %{name}-%{version} + +%build +%configure --localstatedir=%{_localstatedir}/lib +%make_build + +%install +%make_install + +mkdir -p %{buildroot}{%{_sysconfdir},/etc/cron.daily} +install -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/updatedb.conf +install -D -p -m 750 %{SOURCE2} %{buildroot}%{_libexecdir}/mlocate-run-updatedb +install -D -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/mlocate-updatedb.service +install -D -p -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/mlocate-updatedb.timer + +# %%ghost semantics is so stupid +touch %{buildroot}%{_localstatedir}/lib/mlocate/mlocate.db + +%find_lang mlocate + +%pre +getent group slocate > /dev/null || groupadd -g 21 -r -f slocate +exit 0 + +%post +if grep -q '^[^#]*DAILY_UPDATE' %{_sysconfdir}/updatedb.conf; then + sed -i.rpmsave -e '/DAILY_UPDATE/s/^/#/' %{_sysconfdir}/updatedb.conf +fi +%systemd_post mlocate-updatedb.timer +systemctl start mlocate-updatedb.timer + +%preun +%systemd_preun mlocate-updatedb.timer + +%postun +%systemd_postun_with_restart mlocate-updatedb.timer + +%triggerin -- %{name} < 0.26-11 +systemctl start mlocate-updatedb.timer + +%files -f mlocate.lang +%doc AUTHORS COPYING NEWS README +%config(noreplace) %{_sysconfdir}/updatedb.conf +%attr(2711,root,slocate) %{_bindir}/locate +%{_bindir}/updatedb +%{_unitdir}/mlocate-updatedb.service +%{_unitdir}/mlocate-updatedb.timer +%{_libexecdir}/mlocate-run-updatedb +%dir %attr(0750,root,slocate) %{_localstatedir}/lib/mlocate +%ghost %attr(0640,root,slocate) %{_localstatedir}/lib/mlocate/mlocate.db + +%files help +%{_mandir}/man*/* + +%changelog +* Wed Jul 18 2018 openEuler Buildteam - version-release +- Package init \ No newline at end of file diff --git a/updatedb.conf b/updatedb.conf new file mode 100644 index 0000000..8b0b8e1 --- /dev/null +++ b/updatedb.conf @@ -0,0 +1,4 @@ +PRUNE_BIND_MOUNTS = "yes" +PRUNEFS = "9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset debugfs devpts ecryptfs exofs fuse fuse.sshfs fusectl gfs gfs2 gpfs hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfs nfs4 nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs sockfs sysfs tmpfs ubifs udf usbfs ceph fuse.ceph" +PRUNENAMES = ".git .hg .svn .bzr .arch-ids {arch} CVS" +PRUNEPATHS = "/afs /media /mnt /net /sfs /tmp /udev /var/cache/ccache /var/lib/yum/yumdb /var/lib/dnf/yumdb /var/spool/cups /var/spool/squid /var/tmp /var/lib/ceph"