File suspend.spec of Package suspend.501

#
# spec file for package suspend (Version 0.80.20100129)
#
# Copyright (c) 2010 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 http://bugs.opensuse.org/
#

# norootforbuild


Name:           suspend
BuildRequires:  glib2-devel gnutls-devel pciutils-devel pkgconfig
%if 0%{?suse_version} > 1020
BuildRequires:  splashy-devel
%endif
%if 0%{?mandriva_version}
BuildRequires:  liblzo-devel
%else
BuildRequires:  lzo-devel
%endif
%ifarch %ix86 x86_64
BuildRequires:  libx86-devel
%endif
%define GITDATE 20100129
Version:        0.80.%{GITDATE}
Release:        6
%define tarversion 0.8.%{GITDATE}
Summary:        A Set Of Tools To Support Sleep Modes
License:        GPLv2+
Url:            http://sourceforge.net/projects/suspend
Group:          System/Console
Source:         %name-%{tarversion}.tar.bz2
Source2:        configure-suspend-encryption.sh
Source3:        README.scripts
Source4:        mkinitrd-boot.kernel.sh
Source5:        mkinitrd-boot.userspace.sh
Patch1:         suspend-comment-configfile-options.diff
Patch2:         suspend-susescripts.diff
Patch3:         suspend-default-compress.diff
Patch4:         suspend-disable-bootsplash.diff
Patch5:         suspend-default-splash.diff
Patch6:         suspend-0.80-dont-return-eintr-on-abort.diff
Patch7:         suspend-0.80-fix-s2both-resume-hacks.diff
Patch10:        suspend-0.80-keygen-new-defaults.diff
Patch11:        suspend-0.80-make-whitelist-test.diff
Patch12:        suspend-buildfixes.diff
Patch13:        suspend-0.80-vbetool-retry-on-errors.diff
Patch16:        suspend-splash-verbose-debug.diff
Patch17:	s2disk-do-not-fail-hibernation-withoug-a-vt-console
Patch18:	suspend-install-needs-etc
Patch99:        suspend-0.80-opensuse.org.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %ix86 x86_64 ppc ppc64
%if 0%{?suse_version}
Supplements:    powersave
%endif

%description
A set of tools to support suspending notebooks, working around the
specific problems each machine has.



Authors:
--------
    Pavel Machek <pavel@suse.cz>
    Rafael J. Wysocki <rjw@sisk.pl>
    and others.

%prep
%setup -q -n suspend-%{tarversion}
%patch1 -p1
%patch2 -p0
%patch3 -p0
%patch4 -p0
%patch5 -p0
%patch6 -p1
%patch7 -p1
%patch10 -p1
%patch11 -p0
%patch12 -p0
%patch13 -p0
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch99 -p1
cp %{S:3} scripts/
#cp -vb --suffix=-0.5 %{S:99} whitelist.c

%build
export CFLAGS="$RPM_OPT_FLAGS"
autoreconf -fi
./configure --prefix=/usr \
	--sysconfdir=/etc \
	--with-initramfsdir=/usr/sbin \
	--enable-encrypt \
%if 0%{?suse_version} > 1020
	--enable-splashy \
	--disable-resume-static \
%endif
	--enable-threads \
%if 0%{?suse_version} > 1010
	--docdir=%{_docdir}/%{name} \
%else
	--datadir=/usr/share \
%endif
	--enable-compress
make

%install
make install DESTDIR=$RPM_BUILD_ROOT
%if 0%{?suse_version} > 1100
install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts
install -m 755 %{S:4} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-resume.kernel.sh
install -m 755 %{S:5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-resume.userspace.sh
%endif
install -m 755 %{S:2} $RPM_BUILD_ROOT/usr/sbin/
touch $RPM_BUILD_ROOT/etc/suspend.key

%clean
rm -rf $RPM_BUILD_ROOT

%post
%if 0%{?suse_version} > 1100
if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
  echo "Skipping recreation of existing initial ramdisks, due"
  echo "to presence of /var/lib/no_initrd_recreation_by_suspend"
  exit 0
fi
echo "Recreating all initial ramdiscs. This could take a while."
echo "(Touch /var/lib/no_initrd_recreation_by_suspend to prevent.)"
if [ -x /sbin/mkinitrd_setup ] ; then
  mkinitrd_setup
fi
%endif
if [ "$YAST_IS_RUNNING" != "instsys" -a \
     ! -e /.buildenv -a \
     -x /sbin/update-bootloader -a \
     -x /sbin/mkinitrd ]; then
  /sbin/mkinitrd
  /sbin/update-bootloader --refresh
fi
%if 0%{?suse_version} > 1100

%postun
if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then
  echo "Skipping recreation of existing initial ramdisks, due"
  echo "to presence of /var/lib/no_initrd_recreation_by_suspend"
  exit 0
fi
if [ -x /sbin/mkinitrd_setup ] ; then
  mkinitrd_setup
fi
%endif

%files
%defattr (-,root,root)
%config /etc/suspend.conf
%if 0%{?suse_version} > 1100
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
/lib/mkinitrd/scripts/boot-resume.kernel.sh
/lib/mkinitrd/scripts/boot-resume.userspace.sh
%endif
%ghost %config(noreplace) /etc/suspend.key
/usr/sbin/s2disk
/usr/sbin/s2ram
/usr/sbin/s2both
/usr/sbin/resume
/usr/sbin/suspend-keygen
/usr/sbin/swap-offset
/usr/sbin/configure-suspend-encryption.sh
%doc README README.s2ram-whitelist README.encryption HOWTO COPYING conf/suspend.conf
%if %suse_version < 1020
%doc doc/installation-on-SUSE-10.1.txt scripts/
%endif

%changelog