Summary:        Read a preset list of files into memory.
Summary(ja):    あらかじめ指定したファイル群をメモリに先読みするツール
Name:           readahead
Version:        1.5.7
Release:	1%{?_dist_release}
Group:          System Environment/Base
License:        GPLv2+
URL:		https://hosted.fedoraproject.org/readahead
Source0:	readahead-%{version}.tar.bz2
Patch0:		better-cron.patch
Patch1:         readahead-1.5.6-autocollector.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
Requires(post):	/sbin/chkconfig
Requires(pre): 	/sbin/chkconfig
Requires(triggerpostun): /sbin/chkconfig
Requires:	procps, gawk
Requires:       upstart /usr/bin/ionice
BuildRequires:	e2fsprogs-devel, audit-libs-devel, libblkid-devel
BuildRequires:	pkgconfig

%description
readahead reads the contents of a list of files into memory,
which causes them to be read from cache when they are actually
needed. Its goal is to speed up the boot process.

%description -l ja
readahead はあらかじめ指定されたファイルをメモリに読み込んでおき、
実際に必要になったときにキャッシュから読み込まれるようにします。
このツールの目的は起動プロセスの高速化です。

%prep
%setup -q
%patch0 -p1 -b .cron
%patch1 -p1 -b .collector

%build
%configure --sbindir=/sbin
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/readahead

%find_lang %{name}

# for delete systemd require file
rm -rf %{buildroot}/lib/systemd/system/*

%clean
rm -rf ${RPM_BUILD_ROOT}

%preun
if [ "$1" = "0" ] ; then
 # for updating older packages with service files
 /sbin/service readahead_later stop >/dev/null 2>&1
 /sbin/chkconfig --del readahead_later  >/dev/null 2>&1
 /sbin/service readahead_early stop >/dev/null 2>&1
 /sbin/chkconfig --del readahead_early  >/dev/null 2>&1
 :
fi

%post
%{_sysconfdir}/cron.monthly/readahead-monthly.cron
:

%files -f %{name}.lang
%defattr(-,root,root,- )
%doc COPYING README lists/README.lists NEWS
%{_sysconfdir}/cron.daily/readahead.cron
%{_sysconfdir}/cron.monthly/readahead-monthly.cron
%dir %{_localstatedir}/lib/readahead
%{_sysconfdir}/init/readahead-collector.conf
%{_sysconfdir}/init/readahead-disable-services.conf
%{_sysconfdir}/init/readahead.conf
%config(noreplace) %{_sysconfdir}/sysconfig/readahead
%config(noreplace) %{_sysconfdir}/readahead.conf
/sbin/readahead
/sbin/readahead-collector
%dir /lib/readahead
/lib/readahead/readahead-collect.sh
/lib/readahead/readahead-replay.sh
/lib/readahead/readahead-sort.sh

%changelog
* Tue Oct 26 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.7-1
- new upstream release
- cleaned up spec
- renumberd patches
- added patch1 from mandriva

* Wed Jun 16 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.6-1
- new upstream release
- dropt patche0,1,2,4 and other sources
- added Requires: upstart, /usr/bin/ionice
- set up for upstart

* Sun Oct 25 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.4-1
- new upstream release
- added %preun to delete old service
- added configure option
- added BuildRequires: libblkid-devel

* Tue Oct 13 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.3-1
- new upstream release
- dropt Pacth3,5
- renumbered Patch
- added Patch4 (multiple-ignores.patch) from Debian

* Thu Oct 8 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.1-2
- fixed Patch number in changelog Thu Sep 24 2009
- added Patch4,5 from Debian

* Thu Sep 24 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.1-1
- new upstream release
- added Patch3 from Fedora

* Sun Sep 13 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.5.0-1
- new upstream release
- updated and renamed Patch0: readahead-1.5.0-default.patch

* Fri Aug 07 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.9-5
- add /usr/share/anthy to exclude list

* Sun Aug 01 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.9-4
- /etc/readahead.d moved to /var/lib/readahead

* Sat May  9 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.4.9-3
- fix readahead_early (Source1) to check wheter /etc/readahead.d/*.early
  do exist

* Fri May  1 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.4.9-2
- include /etc/readahead.d directory (otherwise /sbin/readahead_early
  will exit with non-zero exit status)

* Sat Apr 11 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> - 1.4.9-1
- new upstream release
- updated and renamed Patch0: readahead-1.4.9-default.patch

* Sat Dec 13 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.6-1
- new upstream release
- remove readahead_later, use preload for this.
- add some patches from mdk
- remove initscripts, will be handle in rc.sysinit

* Wed Oct 15 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3-1
- initial build for Vine Linux

* Fri Feb  2 2007 Karel Zak <kzak@redhat.com> - 1:1.3-7
- rebuild (update file lists)

* Tue Jan 16 2007 Karel Zak <kzak@redhat.com> - 1:1.3-6
- update file lists (215503)

* Sun Oct 01 2006 Jesse Keating <jkeating@redhat.com> - 1:1.3-5
- rebuilt for unwind info generation, broken in gcc-4.1.1-21

* Fri Sep 22 2006 Karel Zak <kzak@redhat.com> 1:1.3-4
- fix #207631 - clean up package build system and use tarball instead
                separated source files

* Fri Sep 22 2006 Karel Zak <kzak@redhat.com> 1:1.3-3
- fix #207631 - readahead has no debuginfo

* Mon Jul 20 2006 Karel Zak <kzak@redhat.com> 1:1.3-1
- move lists of files to /etc/readahead.d
- add readahead-check to docs
- ignore duplicate files

* Wed Jul 19 2006 Jesse Keating <jkeating@redhat.com> - 1:1.2-3
- fix release for upgrade path (by removing cvs generated release)

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1:1.2-1.26
- rebuild

* Thu Mar 16 2006 Karel Zak <kzak@redhat.com>
- update versions in *.in lists

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1:1.2-1.24.2
- bump again for double-long bug on ppc(64)

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1:1.2-1.23.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Fri Jan 13 2006 Karel Zak <kzak@redhat.com>
- check & cleanup list of files by readahead-gen script

* Wed Dec 21 2005 Karel Zak <kzak@redhat.com>
- removed double slashes in the directory names
- removed or fixed the rest of X11R6 directories

* Mon Dec 19 2005 Karel Zak <kzak@redhat.com>
- sync versioned gcc, firefox, openoffice.org, evolution dirs with FC5

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Thu Aug  4 2005 Dave Jones <davej@redhat.com>
- Integrated changes from Ville Skytta (#164872)
  - Fix inverted logic in readahead_early also.
  - readahead_early looks useful in more runlevels than just 5.
  - Sync versioned gcc, firefox and openoffice.org dirs with FC4 updates.

* Tue Aug  2 2005 Dave Jones <davej@redhat.com>
- Fix inverted free memory test in startup script. (#164872)

* Wed May 18 2005 Bill Nottingham <notting@redhat.com>
- new readahead.c from Ziga Mahkovec <ziga.mahkovec@klika.si>
  - optimizes read access for more throughput
- regenerate file lists (#128444)
- fix lack of newlines (#146744)
- fix lists so that they are architecture-neutral
- move check for > 384MB into the init scripts, not the %%post

* Tue Mar  1 2005 Dave Jones <davej@redhat.com>
- Rebuild for gcc4

* Thu Feb 10 2005 Dave Jones <davej@redhat.com>
- Remove non-existent files from file lists.

* Fri Jan 14 2005 Dave Jones <davej@redhat.com>
- Don't do readahead if we have less than 256MB of memory.

* Sat Dec 18 2004 Dave Jones <davej@redhat.com>
- Initial packaging, based upon kernel-utils.

