]> git.pld-linux.org Git - projects/geninitrd.git/blame - mod-suspend.sh
truncate the date to cut out locale formats
[projects/geninitrd.git] / mod-suspend.sh
CommitLineData
dea07ca3 1#!/bin/sh
476f99fc 2RCSID='$Revision$ $Date:: $'
05c474b5 3
dea07ca3 4# geninitrd mod: suspend
6e49b0b1 5USE_SUSPEND=${USE_SUSPEND:-yes}
dea07ca3
ER
6
7# resume device
8resume_dev=""
9
dea07ca3
ER
10# setup geninitrd module
11# @access public
12setup_mod_suspend() {
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!"
16 fi
347ce740
ER
17
18 resume=$(find_tool $initrd_dir/resume /usr/${_lib}/suspend/resume /usr/sbin/resume)
19
6e49b0b1 20 if [ ! -x "$resume" ] || [ ! -f /etc/suspend.conf ]; then
347ce740
ER
21 USE_SUSPEND=no
22 fi
dea07ca3
ER
23}
24
25# find modules for for suspend
26# @access public
27find_modules_suspend() {
dea07ca3
ER
28 resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
29
30 local vgvolumes=$VGVOLUMES
31 find_modules_for_devpath $resume_dev
32
33 if [ "$VGVOLUMES" != "$vgvolumes" ]; then
34 # save our VG to be able to differenciate between rootfs VG
35 SUSPENDVG=$VGVOLUMES
36 VGVOLUMES=$vgvolumes
37 debug "suspend device is on LVM"
38 fi
39}
40
41# generate initrd fragment
42# @access public
43initrd_gen_suspend() {
1b481849
ER
44 if ! is_yes "$USE_SUSPEND"; then
45 return
46 fi
47
94b9755a
ER
48 debug "Setting up suspend..."
49
dea07ca3
ER
50 mknod $DESTDIR/dev/snapshot c 10 231
51 mkdir -p $DESTDIR${resume_dev%/*}
52 inst $resume_dev $resume_dev
53
54 inst /etc/suspend.conf /etc/suspend.conf
55 if [ -x /usr/${_lib}/suspend/resume ]; then
56 inst_exec /usr/${_lib}/suspend/resume /bin/resume
57 else
58 inst_exec /usr/sbin/resume /bin/resume
59 fi
60
61 add_linuxrc <<-'EOF'
62 resume=no
63 for arg in $CMDLINE; do
64 if [ "${arg##resume=}" != "${arg}" ]; then
65 resume=yes
66 fi
67 done
68 if [ "$resume" = "yes" ]; then
69 resume
70 fi
71 EOF
72}
This page took 0.306169 seconds and 4 git commands to generate.