File preload.spec of Package preload.import4437

# spec file for package preload
# Copyright (c) 2011 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

# norootforbuild

Name:           preload
Version:        1.2
Release:        6.<RELEASE7>
Summary:        Preloads Files into System Cache for Faster Booting
License:        GPLv2+
Group:          System/Boot
# svn export
Source0:        preload.tar.bz2
Source1:        %name-rpmlintrc
Source2:        preamble
Source6:        bootfaster.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  e2fsprogs-devel gcc-c++ update-desktop-files
PreReq:         %fillup_prereq %insserv_prereq
# for the kmp
BuildRequires:  kernel-source kernel-syms module-init-tools systemtap
BuildRequires:  kernel-default kernel-default-base-debuginfo kernel-default-debuginfo kernel-default-devel-debuginfo
BuildRequires:  kernel-desktop kernel-desktop-base-debuginfo kernel-desktop-debuginfo kernel-desktop-devel-debuginfo
ExclusiveArch:  %ix86 x86_64
Recommends:     preload-kmp systemtap-runtime
%suse_kernel_module_package -p %_sourcedir/preamble  kdump um debug trace xen vim pae

Preload lists files to load into the system cache. This shortens system
boot time if used correctly.

%package KMP
License:        GPLv2+
Summary:        Preload Kernel Module
Group:          System/Boot

%description KMP
This will work with preload hand in hand to make sure no unnecessary
files are preload.

%setup -n preload
mkdir obj

# ugly work around for bnc#588293
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    rm -rf source
    mkdir source
    cp stap/preloadtrace.stp stap/Kbuild source
    touch source/preloadtrace.c
    kernels=`cd /usr/lib/debug/lib/modules && ls -1d *-$flavor `
    cp -r source obj/$flavor
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules M=$PWD/obj/$flavor 
    stap -p 4 -DMAXSTRINGSIZE=300 -DMAXSKIPPED=2000 -DSTAP_NEED_GETTIMEOFDAY=1 -r $kernels -m preloadtrace  obj/$flavor/preloadtrace.stp
    mv preloadtrace.ko obj/$flavor 

mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/usr/sbin
mkdir -p $RPM_BUILD_ROOT/etc/init.d
#mkdir -p $RPM_BUILD_ROOT/etc/cron.daily
install -m 755 preload $RPM_BUILD_ROOT/sbin
install -m 755 preload-client $RPM_BUILD_ROOT/sbin
install -m 755 print-bmap $RPM_BUILD_ROOT/sbin
#install -m 755 update_preload $RPM_BUILD_ROOT/usr/bin
#install -m 755 bootcache $RPM_BUILD_ROOT/usr/sbin
install -m 755 prepare_preload $RPM_BUILD_ROOT/usr/bin
install -m 755 init.earlyxdm $RPM_BUILD_ROOT/etc/init.d/earlyxdm
install -m 755 init.startpreload $RPM_BUILD_ROOT/etc/init.d/boot.startpreload
install -m 755 init.stoppreload $RPM_BUILD_ROOT/etc/init.d/stoppreload
install -m 755 stop_preload $RPM_BUILD_ROOT/usr/sbin
install -m 755 waitforidle $RPM_BUILD_ROOT/usr/bin/waitforidle
#install -m 755 cron $RPM_BUILD_ROOT/etc/cron.daily/
# empty dir
mkdir -p $RPM_BUILD_ROOT/var/cache/preload
#mkdir -p $RPM_BUILD_ROOT/opt/kde3/share/autostart
#install -m 644 appspreload.desktop $RPM_BUILD_ROOT/opt/kde3/share/autostart
#install -m 755 $RPM_BUILD_ROOT/usr/bin
##suse_update_desktop_file -n $RPM_BUILD_ROOT/opt/kde3/share/autostart/appspreload.desktop
cp %{S:6} .
export INSTALL_MOD_DIR=systemtap
for flavor in %flavors_to_build; do
    make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \

%{fillup_and_insserv -ny preload earlyxdm}
%{fillup_and_insserv -nY preload boot.startpreload}
%{fillup_and_insserv -nY preload stoppreload}



%defattr(-, root, root)
%doc bootfaster.diff

openSUSE Build Service is sponsored by