2 # geninitrd mod: suspend
3 USE_SUSPEND=${USE_SUSPEND:-yes}
8 # setup geninitrd module
11 # XXX this needs tuxonice loaded first
12 if is_yes "$USE_SUSPEND" && is_yes "$USE_TUXONICE"; then
13 warn "Tuxonice and mainline suspend are exclusive!"
16 resume=$(find_tool $(get_libdir /usr/LIBDIR/suspend/resume) $initrd_dir/resume /usr/sbin/resume)
18 if [ ! -x "$resume" ] || [ ! -f /etc/suspend.conf ]; then
21 resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
22 if [ -z "$resume_dev" ]; then
23 warn "Option 'resume device' not found in /etc/suspend.conf. Disabling suspend support."
29 # find modules for for suspend
31 find_modules_suspend() {
32 resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
35 local vgvolumes=$LVM_VGVOLUMES
36 find_modules_for_devpath $resume_dev
38 # check for saved state, differenciate between rootfs VG
39 if [ "$LVM_VGVOLUMES" != "$vgvolumes" ]; then
40 # save suspend VG int oseparate var
41 LVM_SUSPENDVG=$LVM_VGVOLUMES
42 LVM_VGVOLUMES=$vgvolumes
43 verbose "suspend device is on LVM"
47 # generate initrd fragment
49 initrd_gen_suspend() {
50 if ! is_yes "$USE_SUSPEND"; then
54 verbose "Setting up suspend..."
56 mknod -m 640 $DESTDIR/dev/snapshot c 10 231
57 mkdir -p $DESTDIR${resume_dev%/*}
58 inst $resume_dev $resume_dev
60 inst /etc/suspend.conf /etc/suspend.conf
61 inst_exec $resume /bin/resume
65 for arg in $CMDLINE; do
66 if [ "${arg##resume=}" != "${arg}" ]; then
67 resume=${arg##resume=}
70 if [ "$resume" = "yes" ]; then