2 SUSPEND_RCSID='$Revision$ $Date:: $'
4 # geninitrd mod: suspend
5 USE_SUSPEND=${USE_SUSPEND:-yes}
10 # setup geninitrd module
13 # XXX this needs tuxonice loaded first
14 if is_yes "$USE_SUSPEND" && is_yes "$USE_TUXONICE"; then
15 warn "Tuxonice and mainline suspend are exclusive!"
18 resume=$(find_tool $initrd_dir/resume /usr/${_lib}/suspend/resume /usr/sbin/resume)
20 if [ ! -x "$resume" ] || [ ! -f /etc/suspend.conf ]; then
25 # find modules for for suspend
27 find_modules_suspend() {
28 resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
31 local vgvolumes=$LVM_VGVOLUMES
32 find_modules_for_devpath $resume_dev
34 # check for saved state, differenciate between rootfs VG
35 if [ "$LVM_VGVOLUMES" != "$vgvolumes" ]; then
36 # save suspend VG int oseparate var
37 LVM_SUSPENDVG=$LVM_VGVOLUMES
38 LVM_VGVOLUMES=$vgvolumes
39 debug "suspend device is on LVM"
43 # generate initrd fragment
45 initrd_gen_suspend() {
46 if ! is_yes "$USE_SUSPEND"; then
50 debug "Setting up suspend..."
52 mknod $DESTDIR/dev/snapshot c 10 231
53 mkdir -p $DESTDIR${resume_dev%/*}
54 inst $resume_dev $resume_dev
56 inst /etc/suspend.conf /etc/suspend.conf
57 if [ -x /usr/${_lib}/suspend/resume ]; then
58 inst_exec /usr/${_lib}/suspend/resume /bin/resume
60 inst_exec /usr/sbin/resume /bin/resume
65 for arg in $CMDLINE; do
66 if [ "${arg##resume=}" != "${arg}" ]; then
67 resume=${arg##resume=}
70 if [ "$resume" = "yes" ]; then