Package hibernate: Specfile

%define nuserui suspend2-userui-0.7.2

Name: hibernate
Version: 1.97
Release: alt2

Summary: Software suspend 2 hibernate script
License: GPL
Group: System/Kernel and hardware
URL: http://www.tuxonice.net/
Packager: Valery Inozemtsev <shrek@altlinux.ru>

Source0: http://www.tuxonice.net/downloads/all/%name-script-%version.tar.gz
Source1: http://www.tuxonice.net/downloads/all/%nuserui.tar.gz
Source2: hibernate-cleanup

Patch0: hibernate-script-1.94-alt-fglrx-unbreak.patch
Patch1: hibernate-script-1.94-alt-pause-cmus.patch
Patch2: hibernate-script-1.97-alt-su.patch
Patch3: hibernate-script-1.94-alt-suspend2-old-behaviour.patch
Patch4: hibernate-script-1.97-alt-blacklisted-modules.patch
Patch5: hibernate-script-1.97-alt-default-fix.patch
Patch6: hibernate-1.97-rcval_cleanup.patch
Patch7: hibernate-script-1.97-alt-kopete.patch

Patch10: suspend2-userui-0.7.2-alt.patch

Requires: hibernate-cleanup

%description
hibernate is a shell script that handles the process of getting ready
to suspend to disk and to resume from disk. It requires the Software
Suspend 2 patches available at http://www.tuxonice.net/.
After installing you will want to run 'hibernate -h' to see available
options and modify your /etc/hibernate/hibernate.conf to set them.
This package includes %nuserui in the installation.

%package -n vim-plugin-%name-syntax
Group: Editors
Summary: Hibernate config syntax highlight script for VIm
Requires: %name = %version
Requires: vim-common >= 4:6.3.007-alt1

%description -n vim-plugin-%name-syntax
Syntax highlighting VIm plugin for configs of hibernate script.
You need this plugin if you want to edit your /etc/hibernate/*.conf
with highlighting of errors or deprecated parameters.

%package -n hibernate-cleanup
Group: System/Kernel and hardware
Summary: cleanses swsusp and Software Suspend 2 images.

%description -n hibernate-cleanup
This script evokes hibernate-cleanup.sh. It invalidates any stale 
swsusp and Software Suspend 2 images. It searches all swap partitions 
on your machine, as well as Suspend2's filewriter files (by way of 
the hibernate script telling it where to find it).

%prep
%setup -q -n hibernate-script-%version -a1

%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%patch10 -p0

%build
pushd %nuserui
%make clean
%make tuxoniceui_text CFLAGS="%optflags -O2"
popd

%install
export 	BASE_DIR=%buildroot \
	PREFIX=%_prefix \
	MAN_DIR=%buildroot%_mandir \
	SCRIPTLET_DIR=%buildroot%_sysconfdir/hibernate/scriptlets.d/

sh install.sh

unset BASE_DIR PREFIX MAN_DIR SCRIPTLET_DIR

mkdir -p %buildroot{%_sysconfdir/{logrotate.d,rc.d/scripts,rc.d/init.d},%_datadir/vim/vimfiles/syntax}
install -m644 logrotate.d-hibernate-script %buildroot%_sysconfdir/logrotate.d/%name
install -m755 %nuserui/tuxoniceui_text %buildroot%_sbindir
install -m644 hibernate.vim %buildroot%_datadir/vim/vimfiles/syntax/
install -m755 init.d/hibernate-cleanup.sh %buildroot%_sysconfdir/rc.d/scripts/
install -m755 %SOURCE2 %buildroot%_initdir/

mkdir -p doc/%nuserui
cp -a README CHANGELOG SCRIPTLET-API admin doc/
cp -a %nuserui/{KERNEL_API,USERUI_API,ChangeLog,README,TODO} doc/%nuserui/

%post -n hibernate-cleanup
%post_service hibernate-cleanup

%preun -n hibernate-cleanup
%preun_service hibernate-cleanup

%files
%doc doc/*
%_sbindir/*
%config(noreplace) %_sysconfdir/hibernate
%_sysconfdir/logrotate.d/%name
%_mandir/man?/*

%files -n vim-plugin-%name-syntax
%_datadir/vim/vimfiles/syntax/*

%files -n hibernate-cleanup
%config %_sysconfdir/rc.d/scripts/*
%config %_initdir/*

%changelog
* Fri Feb 08 2008 Valery Inozemtsev <shrek@altlinux.ru> 1.97-alt2
- inform running kopete instances of suspend/resume to let them go offline/online

* Mon Feb 04 2008 Valery Inozemtsev <shrek@altlinux.ru> 1.97-alt1
- 1.97
- requires kernel >= 2.6.24

* Tue Oct 02 2007 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt10
- fixed build with glibc-kernheaders

* Tue Feb 27 2007 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt9
- removed obsoletes suspend (closed #10946)

* Mon Feb 19 2007 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt8
- rollback suspen2-userui to 0.6.4

* Fri Feb 16 2007 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt7
- suspen2-userui-0.7.0
- added hibernate-script-1.94-alt-fglrx-unbreak.patch (#10605)

* Thu Dec 28 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt6
- fixed all cause su (#10440)
- added support pause_audio for cmus

* Mon Dec 25 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt5
- fixed hibernate-cleanup start (#10519)

* Sun Dec 10 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt4
- fixed pause_audio scriptlet (#10440)

* Sun Dec 10 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt3
- added hibernate-script-1.94-alt-suspend2-old-behaviour.patch,
	suspend2-userui-0.6.4-alt-path-fixes.patch (wrar@)

* Fri Dec 01 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt2
- added to blacklisted modules:
  snd_intel8x0, ircomm_tty, ircomm, nsc_ircc, irda, crc_ccitt, lt_serial

* Tue Nov 28 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.94-alt1
- hibernate-script-1.94

* Mon Nov 27 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.91-alt2
- added hibernate-script-1.91-scriptlet-backport194.patch

* Tue Jun 20 2006 Valery Inozemtsev <shrek@altlinux.ru> 1.91-alt1
- hibernate-script-1.91
- suspen2-userui-0.6.4
- removed kernel version from config file name

* Tue Dec 27 2005 Alex Yustasov <yust@altlinux.ru> 1.12-alt11
- suspen2-userui-0.6.2 - for kernel >= 2.6.14-wks26-alt2

* Fri Oct 07 2005 Alex Yustasov <yust@altlinux.ru> 1.12-alt1
- hibernate 1.12

* Thu Sep 01 2005 Alex Yustasov <yust@altlinux.ru> 1.10-alt3
- suspend-userui-0.6.1

* Thu Aug 11 2005 Alex Yustasov <yust@altlinux.ru> 1.10-alt2
- added slamr to the blacklist

* Wed Aug 10 2005 Alex Yustasov <yust@altlinux.ru> 1.10-alt1
- userui 0.5.1
- added service hibernate-cleanup

* Sat Jul 23 2005 Andrey Rahmatullin <wrar@altlinux.ru> 1.10-alt0.1
- hibernate 1.10
- userui 0.5.2
- remove BuildRequires for fbsplash
- install bundled logrotate script
- package vim syntax highlighting script separately

* Sat Jul 16 2005 Alex Yustasov <yust@altlinux.ru> 1.09-alt3
- changed default values:
    Compressor to none
    userui to ui_text
- removed build for fbsplash

* Sat Jul 09 2005 Alex Yustasov <yust@altlinux.ru> 1.09-alt2
- userui 0.5.0

* Tue Jun 28 2005 Alex Yustasov <yust@altlinux.ru> 1.09-alt1
- hibernate 1.09

* Fri May 20 2005 Alex Yustasov <yust@altlinux.ru> 1.08-alt4
- removed suspend2ui_bootsplash

* Thu May 19 2005 Alex Yustasov <yust@altlinux.ru> 1.08-alt3
- added suspend2ui_bootsplash
- fixed scriptslet.d for suspend2ui_bootsplash

* Fri May 13 2005 Alex Yustasov <yust@altlinux.ru> 1.08-alt2
- hibernate 1.08
- removed hibernate-alt-swsusp2_15.patch

* Mon May 09 2005 Andrey Rahmatullin <wrar@altlinux.ru> 1.07-alt0.1
- hibernate 1.07
- userui 0.3.1
- spec cleanup

* Wed Mar 16 2005 Alex Yustasov <yust@altlinux.ru> 1.05-alt2
- added userui-0.3.0
- changed BuildArch, URL, description

* Wed Feb 09 2005 Alex Yustasov <yust@altlinux.ru> 1.05-alt1
- 1.05 version
- added button to the blacklist for 2.4 kernel
- fixed chvt 63 in scriptlets.d/swsusp2_15
- added notifempty in logrotate.d/hibernate

* Sun Jan 16 2005 Alex Yustasov <yust@altlinux.ru> 1.03-alt1
- 1.03 version
- added /etc/logrotate.d/hibernate
- added via-rhine, mii to the blacklist
- added WiggleConsole option in scriptlets.d/xhacks

* Sun Nov 28 2004 Alex Yustasov <yust@altlinux.ru> 1.02-alt1
- 1.02 version

* Tue Nov 23 2004 Alex Yustasov <yust@altlinux.ru> 1.01-alt1
- 1.01 version
- added lt_serial to the blacklist

* Tue Nov 09 2004 Alex Yustasov <yust@altlinux.ru> 1.00-alt2
- added cifs, button to the blacklist
- moved scriptlets.d/ to /etc/hibetnate

* Mon Nov 08 2004 Alex Yustasov <yust@altlinux.ru> 1.00-alt1
- 1.00 version
- added config files for 2.4/2.6 kernels

* Fri Oct 22 2004 Alex Yustasov <yust@altlinux.ru> 0.99-alt2
- changed name

* Fri Oct 15 2004 Alex Yustasov <yust@altlinux.ru> 0.99-alt1
- 0.99 version 

* Tue Aug 24 2004 Alex Yustasov <yust@altlinux.ru> 0.98-alt1
- 0.98 version

* Sat Feb 07 2004 Alex Yustasov <yust@altlinux.ru> 0.18-alt1
- 0.18 version

* Wed Oct 22 2003 Alex Yustasov <yust@altlinux.ru> 0.16-alt3
- fixed packager in changelog for alt2
- added SWSUSP_MOUNT_USING_AUTOFS="no"
- added pausing if SWSUSP_MOUNT_USING_AUTOFS="yes"

* Thu Oct 16 2003 Alex Yustasov <yust@altlinux.ru> 0.16-alt2
- fixed bug with BUILDROOT

* Thu Oct 16 2003 Alex Yustasov <yust@altlinux.ru> 0.16-alt1
- initial release. 0.16
- added buildroot parameter for suspend.sh
- removed checking for root
- removed installation for usleep
- added values for DISTRIB=ALTLinux
- if SWSUSP_LEAVE_X_BEFORE_SUSPEND="nvidia" - called xinit /bin/false
- if SWSUSP_INSERTMODS="modules" - reload modules from /etc/modules
- sync in SUSPEND()
- RemountDevices() before UnloadModules()
- removed changing for STOP_SERVICES_BEFORE_SUSPEND, 
  START_SERVICES_AFTER_RESUME, RESTART_SERVICES in suspend.sh
- added checking for exists services STOP_SERVICES_BEFORE_SUSPEND,
  START_SERVICES_AFTER_RESUME