Re: [PATCH] Generate /etc/initramfs-tools/conf.d/resume during install
On Tue, Jul 28, 2009 at 5:18 PM, Daniel Baumann <firstname.lastname@example.org>
+if [ "$resume_devfs" ] && [ -e "$resume_devfs" ]; then
simplify: if $resume_defs exists, it's also never empty.
+ sed -e "s@^#* *RESUME=.*@RESUME=$resume@" < $resumeconf >
+ mv $resumeconf.new $resumeconf
simplify: busybox's sed understands -i
otherwise looks good from the first look, will have a look and generate
a test image later.
There are a lot of things that could be done to make the script look prettier. My original intent was to try and keep the code as close as possible to that of base-installer's. However, I certainly have no strong feelings about this and so I'm happy to make the requested changes; updated patch attached.
Cody A.W. Somerville
Software Systems Release Engineer
Custom Engineering Solutions Group
Canonical OEM Services
diff -Nur a/live-installer.d/initramfs-tools b/live-installer.d/initramfs-tools
--- a/live-installer.d/initramfs-tools 1969-12-31 20:00:00.000000000 -0400
+++ b/live-installer.d/initramfs-tools 2009-07-28 18:27:53.000000000 -0300
@@ -0,0 +1,29 @@
+# Detect resume partition and write it to configuration file.
+resume_devfs="$(get_resume_partition)" || resume_devfs=
+if [ -e "$resume_devfs" ]; then
+ resume="$(mapdevfs "$resume_devfs")" || resume=
+if [ "$resume" ]; then
+ resume_uuid="$(block-attr --uuid "$resume" || true)"
+ if [ "$resume_uuid" ]; then
+if [ -n "$resumeconf" ] && [ "$resume" ]; then
+ if [ -f $resumeconf ] ; then
+ sed -i "s@^#* *RESUME=.*@RESUME=$resume@" $resumeconf
+ echo "RESUME=$resume" >> $resumeconf