Hi,

I wrote something about integrating s2disk with powersaved (appended).
Please have a look.  [I've already seen that SUSE 10.1 uses the same
mechanism, so this seems to apply to it either.]

I'd like to add it to the package as a "miscellaneous" document.

Greetings,
Rafael


--
Integration of s2disk/resume with existing setups

I. s2disk integration with powersaved on SUSE 10.0

SUSE 10.0 contains the powersaved demon responsible for many tasks
related to power management.  In particular it can handle suspend-to-disk
requests either explicit, for example from the kpowersave desktop applet,
from a "suspend button", from the keyboard etc., or implicit, for example
related to the notebook battery running critical.  Thus if you have installed
s2disk on your SUSE 10.0 system, you may want powersaved to use it for
suspending to disk.

For this purpose you need to edit the /etc/sysconfig/powersave/events file in
which the actions performed by powersaved when it is asked to suspend the
system to disk are defined.  Namely, find the variable
EVENT_GLOBAL_SUSPEND2DISK in this file and observe that by default it is equal
to "prepare_suspend_to_disk screen_saver do_suspend_to_disk".  This means
that by default, when a suspend-to-disk request is made, powersaved will first
run the script prepare_suspend_to_disk from /usr/lib/powersave/scripts/ which
may, among other things, unload some kernel modules that are known to cause
problems during suspend or resume.  Next, it will start the screen saver and
finally, it will ask the kernel to carry out the suspend to disk.  This last
action is represented by "do_suspend_to_disk" and we would like to change it to
something that will call s2disk instead.  Moreover, if s2disk is configured to
use the RSA encryption for protecting keys, we may want to get rid of the
"screen_saver" action which is redundant in such a case.

In order to make powersaved use s2disk instead of the "do_suspend_to_disk"
action, we need to create a special script and place it in
/usr/lib/powersave/scripts/.  The fastest way of doing this is to take

/usr/share/doc/packages/powersave/contrib/example_event_script

replace the lines

echo "i am a custom event script and pollute the syslog." | logger
$LOGGER "i can even do some more sophisticated logging"
DEBUG "and even depending on the DEBUG variable!" WARN

in it with

/usr/local/sbin/s2disk

(where we assume the s2disk binary is in /usr/local/sbin) and save it under a
different name, eg. s2disk_script, in /usr/lib/powersave/scripts/.  Of course,
we also have to change the new script's access rights so that powersaved can
actually execute it, eg. by doing

# chmod a+x /usr/lib/powersave/scripts/s2disk_script

Now, we can change the value of EVENT_GLOBAL_SUSPEND2DISK in
/etc/sysconfig/powersave/events to the following:

"prepare_suspend_to_disk screen_saver s2disk_script"

or, if we don't want the screen saver to be started before the suspend, to
the following:

"prepare_suspend_to_disk s2disk_script"

Now, it is only necessary to restart powersaved and we are done.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to