# # spec file for package mlocate # # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # #Compat macro for new _fillupdir macro introduced in Nov 2017 %if ! %{defined _fillupdir} %define _fillupdir %{_localstatedir}/adm/fillup-templates %endif Name: mlocate Version: 0.26 Release: 28.6 Summary: A utility for finding files by name License: GPL-2.0-only Group: System/Monitoring URL: https://pagure.io/mlocate Source0: https://fedorahosted.org/releases/m/l/%{name}/%{name}-%{version}.tar.xz Source1: updatedb.conf Source2: sysconfig.locate # apparmor profile Source3: usr.bin.locate Source4: usr.bin.updatedb Source5: mlocate.timer Source6: mlocate.service BuildRequires: gettext-tools BuildRequires: grep BuildRequires: sed BuildRequires: systemd-rpm-macros BuildRequires: xz Requires(post): %fillup_prereq Recommends: %{name}-lang = %{version} Provides: findutils:%{_bindir}/locate # findutils is at version 4.5 so we need newer # provides here to get it really obsoleted Provides: findutils-locate = 5.%{version} Obsoletes: findutils-locate < 5.%{version} %if 0%{?suse_version} > 1320 Requires: user(nobody) %endif %description A new locate implementation. The m character stands for merging, because updatedb reuses the existing database to avoid re-reading most of the file system. %lang_package %prep %setup -q # do not check for visibilty by default as we go with nobody sed -i \ -e 's:conf_check_visibility = true:conf_check_visibility = false:g' \ src/conf.c %build export CFLAGS="%{optflags} -fPIE" export LDFLAGS="-pie" %configure \ --localstatedir=%{_localstatedir}/lib \ --enable-nls \ --disable-rpath make groupname=nobody %{?_smp_mflags} %install make DESTDIR=%{buildroot} groupname=nobody install %find_lang %{name} || echo -n >> %{name}.lang # DB file mkdir -p %{buildroot}%{_localstatedir}/lib/%{name} echo -n >> %{buildroot}%{_localstatedir}/lib/%{name}/%{name}.db # Config mkdir -p %{buildroot}%{_sysconfdir} install -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir} # Sysconfig settings install -D -m 644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.locate # systemd units install -D -m 644 %{SOURCE5} %{buildroot}%{_unitdir}/mlocate.timer install -D -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/mlocate.service # rc symlink mkdir -p %{buildroot}%{_sbindir} ln -s /usr/sbin/service %{buildroot}/%{_sbindir}/rcmlocate # apparmor install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/apparmor.d/usr.bin.locate install -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/apparmor.d/usr.bin.updatedb %check make check %{?_smp_mflags} %pre %service_add_pre mlocate.service mlocate.timer %post %{fillup_only -n locate} %service_add_post mlocate.service mlocate.timer %preun %service_del_preun mlocate.service mlocate.timer %postun %service_del_postun mlocate.service mlocate.timer %files %license COPYING %doc AUTHORS ChangeLog README NEWS %config(noreplace) %{_sysconfdir}/updatedb.conf %attr(0755,root,root) %{_bindir}/locate %{_bindir}/updatedb %{_mandir}/man*/* %{_unitdir}/mlocate.timer %{_unitdir}/mlocate.service %dir %{_localstatedir}/lib/mlocate %ghost %{_localstatedir}/lib/mlocate/mlocate.db %{_fillupdir}/* %dir %{_sysconfdir}/apparmor.d/ %{_sysconfdir}/apparmor.d/* %{_sbindir}/rcmlocate %files lang -f %{name}.lang %changelog * Tue Dec 4 2018 Jan Engelhardt - Reduce amount of emitted %%service_* boilerplate. * Fri Nov 30 2018 erictorres4@protonmail.com - Add systemd service and timer units [boo#1115408] - Add rc symlinks for backwards compatibility - Add BuildRequires for systemd-rpm-macros - Minor correction to summary, change 'an' to 'a' - Add commands for registering systemd unit files in install scripts - Update files list to include systemd units - Remove dependency on cron - Move logic from cron script to systemd service unit - Remove all variables except RUN_UPDATEDB_AS from sysconfig.locate * Fri Sep 7 2018 suse-beta@cboltz.de - add capability rules to updatedb AppArmor profile to allow running it as root (boo#1089594#c4) * Thu May 10 2018 tchvatal@suse.com - Add apparmor profile bsc#1089594 * Thu Nov 23 2017 rbrown@suse.com - Replace references to /var/adm/fillup-templates with new %%_fillupdir macro (boo#1069468) * Fri Aug 25 2017 tchvatal@suse.com - Require user nobody wrt bsc#1055634 * Mon Jul 10 2017 tchvatal@suse.com - We moved locks to /run thus do not rely on symlinks * Thu Feb 16 2017 tchvatal@suse.com - Update the umask also in su section where it could be nulled wrt bsc#1019440 * Mon Aug 29 2016 tchvatal@suse.com - Reduce dependencies a bit - Update updatedb.conf wrt bnc#994663 * Wed Jan 20 2016 tchvatal@suse.com - Cron file updates: - Remove the ac/battery detection that does not work - Exit with 1 when the updatedb is not executable * Wed Jan 20 2016 tchvatal@suse.com - Add more mounts to exclude in updatedb.conf * Fri Aug 21 2015 tchvatal@suse.com - Specify umask to allow user redefine the value in login.defs bnc#941296 * Sat Oct 25 2014 tchvatal@suse.com - Remove mention of the locate group that was obsoleted. fixes bnc#902588 * Wed Jun 11 2014 tchvatal@suse.com - Enable testsuite. * Mon May 5 2014 tchvatal@suse.com - Remove some duped fs from PRUNEFS variable. * Tue Apr 15 2014 tchvatal@suse.com - Update once more to always hit the same code and to avoid regressions that are hit only under some setup scenarios. * Thu Apr 3 2014 tchvatal@suse.com - Fix a bug where empty RUN_UPDATEDB_AS="" caused cron fail with unknown arguments if the compat values were empty. * Wed Mar 19 2014 tchvatal@suse.com - Also respect the UPDATEDB_ when not running as root in the cron job. * Mon Mar 17 2014 tchvatal@suse.com - Move the UPDATEDB_ variables parsing to cron service to have it working there as the upstream bash config is not exactly shell interpreted. bnc#861955. - Sadly this way if user runs updatedb by hand it gets not properly populated, but at least the cron works with backcompat way. * Fri Mar 14 2014 tchvatal@suse.com - Include findutils-locate variables in updatedb.conf if user still have them specified. bnc#861955 * This ensures we can still load the variables user can specified in the /etc/sysconfig/locate namely UPDATEDB_PRUNEPATHS and UPDATEDB_PRUNEFS * Fri Mar 14 2014 tchvatal@suse.com - Cleanup with spec-cleaner. * Fri Mar 14 2014 tchvatal@suse.com - Update comments in sysconfig.locate a bit to reflect reality. * Tue Oct 29 2013 tchvatal@suse.com - As discussed run updatedb as nobody and do not use the locate group at all. Wrt bnc#847801. * Mon Sep 9 2013 tchvatal@suse.com - Recommend the language package. * Wed Jun 12 2013 tchvatal@suse.com - Add missing space to description of package. * Mon Jun 3 2013 tchvatal@suse.com - Add COPYING to %%docs macro as reported by cfarrell. * Mon Jun 3 2013 cfarrell@suse.com - license update: GPL-2.0 Multiple instances of (c) Red Hat GPL-2.0 licensing * Thu May 30 2013 tchvatal@suse.com - Fixup provide/obsolete to really work + cleanup spec * Thu May 30 2013 tchvatal@suse.com - More work wrt previous change. Provide/obsolete findutils-locate. * Thu May 30 2013 tchvatal@suse.com - Do not use sgid but require user to be in group locate in order to be able to search. * Sun Dec 2 2012 tchvatal@suse.com - Whitespace / format the spec a bit. * Tue Nov 20 2012 tchvatal@suse.com - Try to shutup the suid error. * Tue Nov 20 2012 tchvatal@suse.com - Run the perm stuff only on new enough suse. * Tue Nov 20 2012 tchvatal@suse.com - Update the verify to adhere specs. * Tue Nov 20 2012 tchvatal@suse.com - Adhere to specs to exit 0 on pre. * Tue Nov 20 2012 tchvatal@suse.com - Add buildroot definition to have it on sle * Tue Nov 20 2012 tchvatal@suse.com - require pwdutils for pre phase * Mon Nov 12 2012 tchvatal@suse.com - silence error about PIE, thanks to darix for suggestions on irc. * Mon Nov 12 2012 tchvatal@suse.com - version bump to latest * Mon Oct 31 2011 prusnak@opensuse.org - spec cleanup * Fri Aug 5 2011 tchvatal@novell.com - Update the docs list * Thu Aug 4 2011 tchvatal@novell.com - Punt useless clean section * Thu Aug 4 2011 tchvatal@novell.com - Initial version 0.24 of mlocate package