[PATCH][live-installer] Detect resume partition and write it to configuration file
Hello,
Please accept this patch which adds live-installer.d/initramfs-tools to the live-installer package. This script (which is based off of code in the base-installer package) will detect the resume partition and write it to the initramfs-tools configuration file at '/etc/initramfs-tools/conf.d/resume'. Basically, it makes hibernation work.
This patch adds a dependency on di-utils (>=1.68) due to the use of the block-attr wrapper script.
Cheers,
--
Cody A.W. Somerville
Software Systems Release Engineer
Foundations Team
Custom Engineering Solutions Group
Canonical OEM Services
Phone: +1-781-850-2087
Cell: +1-613-401-5141
Email: cody.somerville@canonical.com
diff -Nru live-installer/live-installer.d/initramfs-tools live-installer-8+netbook6/live-installer.d/initramfs-tools
--- a/live-installer.d/initramfs-tools 1969-12-31 19:00:00.000000000 -0500
+++ b/live-installer.d/initramfs-tools 2009-08-26 15:41:45.000000000 -0400
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+
+# Detect resume partition and write it to configuration file.
+
+. /usr/lib/base-installer/library.sh
+
+resumeconf=$IT_CONFDIR/resume
+
+resume_devfs="$(get_resume_partition)" || resume_devfs=
+if [ "$resume_devfs" ] && [ -e "$resume_devfs" ]; then
+ resume="$(mapdevfs "$resume_devfs")" || resume=
+else
+ resume=
+fi
+
+if [ "$resume" ]; then
+ resume_uuid="$(block-attr --uuid "$resume" || true)"
+ if [ "$resume_uuid" ]; then
+ resume="UUID=$resume_uuid"
+ fi
+fi
+
+if [ -n "$resumeconf" ] && [ "$resume" ]; then
+ if [ -f $resumeconf ] ; then
+ sed -e "s@^#* *RESUME=.*@RESUME=$resume@" < $resumeconf > $resumeconf.new &&
+ mv $resumeconf.new $resumeconf
+ else
+ echo "RESUME=$resume" >> $resumeconf
+ fi
+fi
Reply to: