2 # - kernel module: doesn't build with Linux 3.x
3 # - device: installed with static major, module creates as dynamic => use udev
4 # - should provide something like virtual(locate), obsolete other implementations
5 # - conflicts: rlocate gid with slocate
9 %bcond_without kernel # don't build kernel modules
10 %bcond_without userspace # don't build userspace module
11 %bcond_with verbose # verbose build (V=1)
15 Summary: Finds files on a system via a central database
16 Summary(pl.UTF-8): Szukanie plików w systemie poprzez centralną bazę danych
22 Source0: http://downloads.sourceforge.net/rlocate/%{name}-%{version}.tar.gz
23 # Source0-md5: b834e2b1249fba9138bea29a030de46c
24 Patch0: %{name}-build.patch
25 Patch1: %{name}-open.patch
26 URL: http://rlocate.sourceforge.net/
27 BuildRequires: autoconf >= 2.50
28 BuildRequires: automake >= 1:1.7.1
30 BuildRequires: kernel-module-build >= 3:2.6
32 BuildRequires: perl-base
33 BuildRequires: rpmbuild(macros) >= 1.228
34 Requires(post,preun): /sbin/chkconfig
35 Requires(postun): /usr/sbin/groupdel
36 Requires(pre): /usr/bin/getgid
37 Requires(pre): /usr/sbin/groupadd
39 Provides: group(rlocate)
41 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44 rlocate is an implementation of the locate command that is always
45 up-to-date. The database that the original locate uses is usually
46 updated only once a day, so newer files cannot be located right away.
47 The behavior of rlocate is the same as slocate, but it also maintains
48 a diff database that gets updated whenever a new file is created. This
49 is accomplished with rlocate kernel module and daemon. The rlocate
50 kernel module can be compiled only with Linux 2.6 kernels.
52 %description -l pl.UTF-8
53 rlocate to implementacja polecenia locate będąca zawsze aktualna. Baza
54 danych używana przez oryginalne polecenie locate jest zwykle
55 uaktualniana raz dziennie, więc nowszych plików nie można znaleźć w
56 ten sposób. Zachowanie rlocate jest takie samo jak slocate, ale
57 rlocate dodatkowo utrzymuje bazę danych różnic uaktualnianą przy
58 tworzeniu każdego nowego pliku. Jest to osiągnięte przy użyciu modułu
59 jądra i demona rlocate. Moduł jądra można skompilować tylko na jądrach
62 %package -n kernel-misc-%{name}
63 Summary: rlocate Linux module
64 Summary(pl.UTF-8): Moduł rlocate dla Linuksa
65 Release: %{_rel}@%{_kernel_ver_str}
67 Requires(post,postun): /sbin/depmod
68 %requires_releq_kernel
69 Requires(postun): %releq_kernel
71 %description -n kernel-misc-%{name}
72 This package contains rlocate Linux module.
74 %description -n kernel-misc-%{name} -l pl.UTF-8
75 Ten pakiet zawiera moduł rlocate dla jądra Linuksa.
89 --localstatedir=/var/lib
95 echo "EXTRA_CFLAGS:= -DRL_VERSION=\\\"%{version}\\\" -DRLOCATE_UPDATES" > src/rlocate-module/Makefile
96 echo "obj-m:= rlocate.o" >> src/rlocate-module/Makefile
98 %build_kernel_modules -m rlocate -C src/rlocate-module
102 rm -rf $RPM_BUILD_ROOT
104 %if %{with userspace}
105 install -d $RPM_BUILD_ROOT{/dev,/etc/rc.d/init.d,%{_sysconfdir}/%{name}}
108 DESTDIR=$RPM_BUILD_ROOT
110 cp -p contrib/rlocate.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/rlocate
111 cp -p debian/updatedb.conf $RPM_BUILD_ROOT%{_sysconfdir}
112 :> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/module.cfg
116 %install_kernel_modules -m src/rlocate-module/rlocate -d misc
120 rm -rf $RPM_BUILD_ROOT
123 %groupadd -g 37 rlocate
126 if [ ! -f /var/lib/rlocate/rlocate.db ]; then
127 echo 'Run "%{_bindir}/updatedb" if you want to make rlocate database immediately.'
129 /sbin/chkconfig --add %{name}
130 %service %{name} restart
133 if [ "$1" = "0" ]; then
134 %service -q %{name} stop
135 /sbin/chkconfig --del %{name}
139 if [ "$1" = "0" ]; then
143 %if %{with userspace}
145 %defattr(644,root,root,755)
146 %doc AUTHORS ChangeLog README
147 %attr(700,root,root) %dir %{_sysconfdir}/%{name}
148 %attr(600,root,root) %ghost %{_sysconfdir}/%{name}/module.cfg
149 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/updatedb.conf
150 %attr(755,root,root) /etc/cron.daily/rlocate
151 %attr(754,root,root) /etc/rc.d/init.d/rlocate
153 %attr(2755,root,rlocate) %{_bindir}/rlocate
154 %attr(2755,root,rlocate) %{_bindir}/rlocate-checkpoint
155 %attr(755,root,root) %{_sbindir}/rlocated
158 %attr(755,root,root) %{_bindir}/updatedb
159 %attr(755,root,root) %{_bindir}/locate
161 %{_mandir}/man1/rlocate.1*
162 %{_mandir}/man1/rlocate-checkpoint.1*
163 %{_mandir}/man1/rlocated.1*
164 %{_mandir}/man1/updatedb.1*
166 # FIXME: use udev to get proper major
167 %attr(400,root,root) %dev(c,254,0) /dev/rlocate
168 %dir %attr(750,root,rlocate) /var/lib/rlocate
172 %files -n kernel-misc-%{name}
173 %defattr(644,root,root,755)
174 /lib/modules/%{_kernel_ver}/misc/rlocate.ko*