#!/bin/sh THE_DATE="`date \"+%B %Y\"`" # Define some dummy functions from the API. AddSuspendHook() { return 0 } AddResumeHook() { return 0 } AddTerminationHandler() { return 0 } AddConfigHandler() { return 0 } AddOptionHandler() { return 0 } AddLongOption() { return 0 } AddShortOption() { return 0 } vecho() { return 0 } ProgramManHeader() { cat < .\" Information on the command line options is automatically generated .\" from the hibernate scripts themselves. .TH HIBERNATE 8 "$THE_DATE" "Linux Software Suspend" "" .SH NAME hibernate \- save your computer's state to disk, and then switch it off .SH SYNOPSIS .B hibernate [\fIOPTION\fR]... .SH DESCRIPTION .PP The hibernate script (or "suspend script") is used to invoke the Linux kernel's Software Suspend functionality. .PP When you hibernate your machine, the contents of your computer's memory will be saved to disc, and your computer will switch off. When you switch it back on again, it will resume exactly as it was when you hibernated. This script is designed for Software Suspend 2, which is not yet included in the main kernel tree and must be downloaded from the Software Suspend web site at \fIhttp://www.suspend2.net/\fR, but can also utilise the vanilla kernel interfaces for swsusp or pmdisk (through /proc/acpi/sleep or /sys/power/state). Instructions on setting up the kernel can also be found on that web site. .PP The hibernate script takes care of the user-space side of the suspend, including unloading and reloading drivers which don't suspend properly, setting the system clock after resuming, taking down and bringing up network interfaces and various other hacks that may be required on some hardware. By default, all it does is restore the system clock after suspending; see .BR hibernate.conf (5) for information on configuring the rest of its functionality. .PP If the hibernate script is invoked with a name of the form .BR hibernate-foo then it will use the configuration file /etc/hibernate/foo.conf instead of the default. .PP The hibernate script accepts the following command-line options: .SH OPTIONS EOT } ProgramManFooter() { cat < .\" Information on the various options is automatically generated .\" from the hibernate scripts themselves. .TH HIBERNATE.CONF 5 "$THE_DATE" "Linux Software Suspend" "" .SH NAME hibernate.conf \- configuration file for the hibernate script .SH SYNOPSIS .I /etc/hibernate/hibernate.conf .SH DESCRIPTION .PP The hibernate script .BR hibernate (8) reads its configuration from the .I /etc/hibernate/hibernate.conf file when it runs (unless an alternative configuration file is specified on the command line. .PP If configuration directives are specified multiple times, typically the last one will take effect. .SH USAGE EOT } ConfigManFooter() { cat <. .PP The information about various options was automatically generated from the hibernate script itself. .SH SEE ALSO .PP .BR hibernate (8) EOT } AddConfigHelp() { (echo $1 ; echo $2 ) | awk ' BEGIN { print ".TP 10\n"; getline; gsub("/-/", "\\-"); ORS=" " print "\\fB"$1"\\fR"; for (i=2; i<=NF; i++) { print $i } ORS="" print "\n" width=70 } { if (substr($0, 1, 1) == " ") for(a=1;a width) { curpos=0 print "\n" } print $i " " curpos = curpos + length($i) + 1 } print "\n" } ' >> $CONFIG_MAN return 0 } AddOptionHelp() { (echo $1 ; echo $2 ) | awk ' BEGIN { print ".TP 16\n"; getline; gsub("--?[\\-a-zA-Z0-9]+", "\\fB&\\fR"); gsub("-", "\\-"); print $0 ORS="" width=70 } { if (substr($0, 1, 1) == " ") for(a=1;a width) { curpos=0 print "\n" } print $i " " curpos = curpos + length($i) + 1 } print "\n" } ' >> $PROGRAM_MAN return 0 } # Create a copy of hibernate.sh with only the help items TMPF=`mktemp /tmp/tmp.hibernate.XXXXXX` awk '{ if ((substr($0, 1, 1) != "#") && (match($0, "AddConfigHelp") || match($0, "AddOptionHelp")) && (match($0, "\\(\\)") == 0)) { print $0; while (substr($0, length($0), 1) != "\"") { getline; print $0; } } }' < hibernate.sh > $TMPF PROGRAM_MAN=hibernate.8 CONFIG_MAN=hibernate.conf.5 ProgramManHeader > $PROGRAM_MAN ConfigManHeader > $CONFIG_MAN # Work starts here for i in $TMPF scriptlets.d/* ; do . $i done rm -f $TMPF ProgramManFooter >> $PROGRAM_MAN ConfigManFooter >> $CONFIG_MAN # $Id$