File mlocate.spec of Package mlocate.openSUSE_13.1_Update

#
# spec file for package mlocate
#
# Copyright (c) 2014 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:        sysconfig.locate
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gettext-tools
BuildRequires:  grep
BuildRequires:  sed
BuildRequires:  xz
Requires:       cron
Requires(post): %fillup_prereq
Requires(pre):  permissions
Requires(pre):  pwdutils
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}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

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

%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}
# Cron
mkdir -p %{buildroot}%{_sysconfdir}/cron.daily
install -p -m 755 %{SOURCE2} %{buildroot}%{_sysconfdir}/cron.daily
# Sysconfig settings
install -D -m 644 %{SOURCE3} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.locate

%post
%{fillup_only -n locate}

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

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

%changelog
openSUSE Build Service is sponsored by