Package init

This commit is contained in:
overweight 2019-09-30 11:04:38 -04:00
commit 71140e93ae
6 changed files with 119 additions and 0 deletions

BIN
mlocate-0.26.tar.xz Normal file

Binary file not shown.

4
mlocate-run-updatedb Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
nodevs=$(< /proc/filesystems awk '$1 == "nodev" && $2 != "rootfs" && $2 != "zfs" { print $2 }')
/usr/bin/updatedb -f "$nodevs"

13
mlocate-updatedb.service Normal file
View File

@ -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

10
mlocate-updatedb.timer Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Updates mlocate database every day
[Timer]
OnCalendar=daily
AccuracySec=24h
Persistent=true
[Install]
WantedBy=timers.target

88
mlocate.spec Normal file
View File

@ -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 <buildteam@openeuler.org> - version-release
- Package init

4
updatedb.conf Normal file
View File

@ -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"