File mlocate.spec of Package mlocate

#
# spec file for package mlocate
#
# Copyright (c) 2013 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


Name:           mlocate
Version:        0.26
Release:        0
Summary:        An utility for finding files by name
License:        GPL-2.0
Group:          System/Monitoring
Url:            https://fedorahosted.org/mlocate/
Source0:        https://fedorahosted.org/releases/m/l/%name/%name-%version.tar.xz
Source1:        updatedb.conf
Source2:        %name.cron
Source3:        %name-cron.conf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gettext-tools
BuildRequires:  grep
BuildRequires:  sed
BuildRequires:  xz
Requires(pre):  permissions
Requires(pre):  pwdutils
Requires:       cron
Provides:       findutils:/usr/bin/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}
Recommends:     %{name}-lang = %{version}

%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.

User must be member of locate group in order to
use this package.

%package lang
Summary:        Language translation files for mlocate
Group:          System/Localization

%description lang
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.

This package installs language translation files
for mlocate if required by multilingual
environments.

%prep
%setup -q

%build
export CFLAGS="%optflags -fPIE"
export LDFLAGS="-pie"
%configure --localstatedir=%_localstatedir/lib --enable-nls
make groupname=locate

%install
rm -rf %buildroot
make DESTDIR=%buildroot groupname=locate install
%find_lang %name || echo -n >> %name.lang
mkdir -p %buildroot%_localstatedir/lib/%name
echo -n >> %buildroot%_localstatedir/lib/%name/%name.db
mkdir -p %buildroot%_sysconfdir
install -p -m 644 %SOURCE1 %buildroot%_sysconfdir
install -p -m 644 %SOURCE3 %buildroot%_sysconfdir
mkdir -p %buildroot%_sysconfdir/cron.daily
install -p -m 755 %SOURCE2 %buildroot%_sysconfdir/cron.daily

%pre
getent group locate >/dev/null || groupadd -r locate
exit 0

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog README NEWS COPYING
%config(noreplace) %_sysconfdir/updatedb.conf
%config(noreplace) %_sysconfdir/mlocate-cron.conf
%_sysconfdir/cron.daily/%name.cron
%attr(0710,root,locate) %_bindir/locate
%_bindir/updatedb
%_mandir/man*/*
%dir %attr(0710,root,locate) %_localstatedir/lib/mlocate
%ghost %_localstatedir/lib/mlocate/mlocate.db

%files lang -f %name.lang
%defattr(-,root,root,-)

%changelog
openSUSE Build Service is sponsored by