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
8 %bcond_without kernel # don't build kernel modules
9 %bcond_without userspace # don't build userspace module
10 %bcond_with verbose # verbose build (V=1)
14 Summary: Finds files on a system via a central database
15 Summary(pl.UTF-8): Szukanie plików w systemie poprzez centralną bazę danych
21 Source0: http://downloads.sourceforge.net/rlocate/%{name}-%{version}.tar.gz
22 # Source0-md5: b834e2b1249fba9138bea29a030de46c
23 Patch0: %{name}-build.patch
24 Patch1: %{name}-open.patch
25 URL: http://rlocate.sourceforge.net/
26 BuildRequires: autoconf >= 2.50
27 BuildRequires: automake >= 1:1.7.1
29 BuildRequires: kernel-module-build >= 3:2.6
31 BuildRequires: perl-base
32 BuildRequires: rpmbuild(macros) >= 1.228
33 Requires(post,preun): /sbin/chkconfig
34 Requires(postun): /usr/sbin/groupdel
35 Requires(pre): /usr/bin/getgid
36 Requires(pre): /usr/sbin/groupadd
38 Provides: group(rlocate)
40 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43 rlocate is an implementation of the ``locate'' command that is always
44 up-to-date. The database that the original locate uses is usually
45 updated only once a day, so newer files cannot be located right away.
46 The behavior of rlocate is the same as slocate, but it also maintains
47 a diff database that gets updated whenever a new file is created. This
48 is accomplished with rlocate kernel module and daemon. The rlocate
49 kernel module can be compiled only with Linux 2.6 kernels.
51 %description -l pl.UTF-8
52 rlocate to implementacja polecenia locate będąca zawsze aktualna. Baza
53 danych używana przez oryginalne polecenie locate jest zwykle
54 uaktualniana raz dziennie, więc nowszych plików nie można znaleźć w
55 ten sposób. Zachowanie rlocate jest takie samo jak slocate, ale
56 rlocate dodatkowo utrzymuje bazę danych różnic uaktualnianą przy
57 tworzeniu każdego nowego pliku. Jest to osiągnięte przy użyciu modułu
58 jądra i demona rlocate. Moduł jądra można skompilować tylko na jądrach
61 %package -n kernel-misc-%{name}
62 Summary: rlocate Linux module
63 Summary(pl.UTF-8): Moduł rlocate dla Linuksa
64 Release: %{_rel}@%{_kernel_ver_str}
66 Requires(post,postun): /sbin/depmod
67 %requires_releq_kernel
68 Requires(postun): %releq_kernel
70 %description -n kernel-misc-%{name}
71 This package contains rlocate Linux module.
73 %description -n kernel-misc-%{name} -l pl.UTF-8
74 Ten pakiet zawiera moduł rlocate dla jądra Linuksa.
88 --localstatedir=/var/lib
94 echo "EXTRA_CFLAGS:= -DRL_VERSION=\\\"%{version}\\\" -DRLOCATE_UPDATES" > src/rlocate-module/Makefile
95 echo "obj-m:= rlocate.o" >> src/rlocate-module/Makefile
97 %build_kernel_modules -m rlocate -C src/rlocate-module
101 rm -rf $RPM_BUILD_ROOT
103 %if %{with userspace}
104 install -d $RPM_BUILD_ROOT{/dev,/etc/rc.d/init.d,%{_sysconfdir}/%{name}}
107 DESTDIR=$RPM_BUILD_ROOT
109 cp -p contrib/rlocate.redhat $RPM_BUILD_ROOT/etc/rc.d/init.d/rlocate
110 cp -p debian/updatedb.conf $RPM_BUILD_ROOT%{_sysconfdir}
111 :> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/module.cfg
115 %install_kernel_modules -m src/rlocate-module/rlocate -d misc
119 rm -rf $RPM_BUILD_ROOT
122 %groupadd -g 37 rlocate
125 if [ ! -f /var/lib/rlocate/rlocate.db ]; then
126 echo 'Run "%{_bindir}/updatedb" if you want to make rlocate database immediately.'
128 /sbin/chkconfig --add %{name}
129 %service %{name} restart
132 if [ "$1" = "0" ]; then
135 if [ "$1" = "0" ]; then
136 %service -q %{name} stop
137 /sbin/chkconfig --del %{name}
140 %if %{with userspace}
142 %defattr(644,root,root,755)
143 %doc AUTHORS ChangeLog README
144 %attr(700,root,root) %dir %{_sysconfdir}/%{name}
145 %attr(600,root,root) %ghost %{_sysconfdir}/%{name}/module.cfg
146 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/updatedb.conf
147 %attr(755,root,root) /etc/cron.daily/rlocate
148 %attr(754,root,root) /etc/rc.d/init.d/rlocate
150 %attr(2755,root,rlocate) %{_bindir}/rlocate
151 %attr(2755,root,rlocate) %{_bindir}/rlocate-checkpoint
152 %attr(755,root,root) %{_sbindir}/rlocated
155 %attr(755,root,root) %{_bindir}/updatedb
156 %attr(755,root,root) %{_bindir}/locate
158 %{_mandir}/man1/rlocate.1*
159 %{_mandir}/man1/rlocate-checkpoint.1*
160 %{_mandir}/man1/rlocated.1*
161 %{_mandir}/man1/updatedb.1*
163 # FIXME: use udev to get proper major
164 %attr(400,root,root) %dev(c,254,0) /dev/rlocate
165 %dir %attr(750,root,rlocate) /var/lib/rlocate
169 %files -n kernel-misc-%{name}
170 %defattr(644,root,root,755)
171 /lib/modules/%{_kernel_ver}/misc/rlocate.ko*