File mlocate.spec of Package mlocate

#
# spec file for package mpdscribble (Version 0.17)
#
# Copyright 2008 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.
#
#norootforbuild

Summary: A locate implementation with speed improvements
Name: mlocate
Version: 0.22
Release: 1
Source: %{name}-%{version}.tar.bz2
#Source1: http://freshmeat.net/urls/7ba5c8767b658bd3832a7a993fd85eca
Vendor: %{vendor}
URL: http://freshmeat.net/projects/mlocate/
License: GPLv2+
Group: Productivity/File Utilities
Conflicts: findutils-locate
BuildRequires: pwdutils
BuildRoot: %{_builddir}/%{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. This makes updatedb faster and does
not trash the system caches as much.

The locate utility is intended to be completely
compatible to slocate. It also attempts to be
compatible to GNU locate, when it does not
conflict with slocate compatibility.

NOTICE: users must pertain into the group mlocate*
for them to be able to search and handle the
locate program.


%prep
%setup -q -a0

%build
if [ -x ./configure ]; then
  CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} \
	--libdir=%{_libdir} \
	--sysconfdir=%{_sysconfdir} \
	--localstatedir=%{_localstatedir}/lib \
	--docdir=%{_docdir}/%{name} \
	--disable-dependancy-tracking \
	--disable-static
else
  CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%{_prefix}
fi
%{__make}

%debug_package

%install
%{__make} DESTDIR=$RPM_BUILD_ROOT install
%{__install} -d -m 755 %{builddir}%{_localstatedir}/lib/mlocate
%find_lang %{name}

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%attr(0750,root,root)%{_bindir}/locate
%attr(0750,root,root)%{_bindir}/updatedb
%attr(0750,root,mlocate)%{_localstatedir}/lib/%{name}
%doc %{_mandir}/man5/%{name}.db.5.gz
%doc %{_mandir}/man1/locate.1.gz
%doc %{_mandir}/man5/updatedb.conf.5.gz
%doc %{_mandir}/man8/updatedb.8.gz
%doc AUTHORS COPYING NEWS README


%pre
if [ ! "`getent group | grep ^mlocate`" ]
then
	%{_sbindir}/groupadd mlocate
fi

if [ -f "%{_localstatedir}/lib/%{name}/%{name}.db" ]
then
	%__mv -f %{_localstatedir}/lib/%{name}/%{name}.db \
	/tmp 2>/dev/null || :
fi


%post
if [ -f "/tmp/%{name}.db" ]
then
	%__mv -f /tmp/%{name}.db \
	%{_localstatedir}/lib/%{name}/ 2>/dev/null || :

	[ "`getent group | grep ^mlocate`" ] && \
	%__chown root:mlocate %{_localstatedir}/lib/%{name} 2>/dev/null || :

	%__chmod 0640 %{_localstatedir}/lib/%{name}/%{name}.db 2>/dev/null || :
fi

[ "`getent group | grep ^mlocate`" ] && \
%__chown root:mlocate %{_bindir}/locate 2>/dev/null || :


#%postun
#[ ! -x "%{_bindir}/%{name}" ] &&
#[ -f "%{_localstatedir}/lib/%{name}/%{name}.db" ] &&
#%__rm -f %{_localstatedir}/lib/%{name}/%{name}.db 2>/dev/null || :



###########################
## Language translations ##
###########################
%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 makes updatedb faster and does

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


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


%changelog
* Fri Jun 5 2009 Mario GarcĂ­a H. <code933k@gmail.com> - 0.22
- Initial package.
openSUSE Build Service is sponsored by