Author: glen
Date: Fri Apr  3 00:39:01 2009
New Revision: 10286

Added:
   geninitrd/trunk/mod-suspend.sh
Modified:
   geninitrd/trunk/Makefile
   geninitrd/trunk/geninitrd
Log:
- suspend modularized

Modified: geninitrd/trunk/Makefile
==============================================================================
--- geninitrd/trunk/Makefile    (original)
+++ geninitrd/trunk/Makefile    Fri Apr  3 00:39:01 2009
@@ -1,6 +1,6 @@
 # when making release, make sure you do it as RELEASE document describes
 VERSION                := 10000.3
-MODS           := mod-ide.sh mod-luks.sh mod-multipath.sh mod-dmraid.sh 
mod-lvm.sh mod-md.sh mod-blkid.sh mod-udev.sh mod-tuxonice.sh
+MODS           := mod-ide.sh mod-luks.sh mod-multipath.sh mod-dmraid.sh 
mod-lvm.sh mod-md.sh mod-blkid.sh mod-udev.sh mod-tuxonice.sh mod-suspend.sh
 FILES          := Makefile geninitrd.sysconfig geninitrd functions $(MODS) 
geninitrd.8 geninitrd.8.xml ChangeLog
 prefix         := /usr
 mandir         := $(prefix)/share/man

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd   (original)
+++ geninitrd/trunk/geninitrd   Fri Apr  3 00:39:01 2009
@@ -18,7 +18,6 @@
 # list of geninitrd modules which need setup routine after commandline args 
parsing
 GENINITRD_MODS=""
 COMPRESS=yes
-USE_SUSPEND=yes
 # it should be safe to remove scsi_mod from here, but I'm not sure...
 PRESCSIMODS="-scsi_mod unknown -sd_mod"
 target=""
@@ -55,9 +54,6 @@
 # whether v86d should be installed
 need_v86d=0
 
-# resume device
-resume_dev=""
-
 # if we should init NFS at boot
 have_nfs=no
 
@@ -702,48 +698,6 @@
        done
 }
 
-find_modules_suspend() {
-       if [ ! -x /usr/${_lib}/suspend/resume -a ! -x /usr/sbin/resume ]; then
-               die "/usr/${_lib}/suspend/resume is missing!"
-       fi
-       resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
-
-       local vgvolumes=$VGVOLUMES
-       find_modules_for_devpath $resume_dev
-
-       if [ "$VGVOLUMES" != "$vgvolumes" ]; then
-               # save our VG to be able to differenciate between rootfs VG
-               SUSPENDVG=$VGVOLUMES
-               VGVOLUMES=$vgvolumes
-               debug "suspend device is on LVM"
-       fi
-}
-
-initrd_gen_suspend() {
-       mknod $DESTDIR/dev/snapshot c 10 231
-       mkdir -p $DESTDIR${resume_dev%/*}
-       inst $resume_dev $resume_dev
-
-       inst /etc/suspend.conf /etc/suspend.conf
-       if [ -x /usr/${_lib}/suspend/resume ]; then
-               inst_exec /usr/${_lib}/suspend/resume /bin/resume
-       else
-               inst_exec /usr/sbin/resume /bin/resume
-       fi
-
-       add_linuxrc <<-'EOF'
-       resume=no
-       for arg in $CMDLINE; do
-               if [ "${arg##resume=}" != "${arg}" ]; then
-                       resume=yes
-               fi
-       done
-       if [ "$resume" = "yes" ]; then
-               resume
-       fi
-       EOF
-}
-
 initrd_gen_v86d() {
        debug "initrd_gen_v86d"
        mknod $DESTDIR/dev/mem c 1 1
@@ -1280,10 +1234,6 @@
        fi
 fi
 
-if is_yes "$USE_SUSPEND" && is_yes "$USE_TUXONICE"; then
-       warn "Tuxonice and mainline suspend are exclusive!"
-fi
-
 if is_yes "$FB_SPLASH"  && is_yes "$BOOT_SPLASH"; then
        warn "bootsplash and fbsplash are exclusive!"
 fi

Added: geninitrd/trunk/mod-suspend.sh
==============================================================================
--- (empty file)
+++ geninitrd/trunk/mod-suspend.sh      Fri Apr  3 00:39:01 2009
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# geninitrd mod: suspend
+
+USE_SUSPEND=yes
+
+# resume device
+resume_dev=""
+
+#
+# setup geninitrd module
+# @access      public
+setup_mod_suspend() {
+       # XXX this needs tuxonice loaded first
+       if is_yes "$USE_SUSPEND" && is_yes "$USE_TUXONICE"; then
+               warn "Tuxonice and mainline suspend are exclusive!"
+       fi
+}
+
+# find modules for for suspend
+# @access      public
+find_modules_suspend() {
+       if [ ! -x /usr/${_lib}/suspend/resume -a ! -x /usr/sbin/resume ]; then
+               die "/usr/${_lib}/suspend/resume is missing!"
+       fi
+       resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
+
+       local vgvolumes=$VGVOLUMES
+       find_modules_for_devpath $resume_dev
+
+       if [ "$VGVOLUMES" != "$vgvolumes" ]; then
+               # save our VG to be able to differenciate between rootfs VG
+               SUSPENDVG=$VGVOLUMES
+               VGVOLUMES=$vgvolumes
+               debug "suspend device is on LVM"
+       fi
+}
+
+# generate initrd fragment
+# @access      public
+initrd_gen_suspend() {
+       mknod $DESTDIR/dev/snapshot c 10 231
+       mkdir -p $DESTDIR${resume_dev%/*}
+       inst $resume_dev $resume_dev
+
+       inst /etc/suspend.conf /etc/suspend.conf
+       if [ -x /usr/${_lib}/suspend/resume ]; then
+               inst_exec /usr/${_lib}/suspend/resume /bin/resume
+       else
+               inst_exec /usr/sbin/resume /bin/resume
+       fi
+
+       add_linuxrc <<-'EOF'
+       resume=no
+       for arg in $CMDLINE; do
+               if [ "${arg##resume=}" != "${arg}" ]; then
+                       resume=yes
+               fi
+       done
+       if [ "$resume" = "yes" ]; then
+               resume
+       fi
+       EOF
+}
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to