[Fedora-livecd-list] [PATCH] add support for mediachecking the live CD.

Jeremy Katz katzj at redhat.com
Thu Apr 19 16:43:23 UTC 2007


Add support for doing a mediacheck on the live CD.  This implants a checksum
into the application data area of the iso9660 image using the tools in
anaconda and then also checks using tools from anaconda.
---
 creator/livecd-creator |    7 +++++++
 creator/mayflower      |   15 +++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/creator/livecd-creator b/creator/livecd-creator
index d9707c3..7117043 100755
--- a/creator/livecd-creator
+++ b/creator/livecd-creator
@@ -877,6 +877,13 @@ label runfromram
                          "-boot-info-table", "-J", "-r", "-hide-rr-moved",
                          "-V", "%s" %(self.fs_label,), "%s/out" %(self.build_dir)])
 
+        # implant an isomd5sum
+        if os.path.exists("/usr/lib/anaconda-runtime/implantisomd5"):
+            subprocess.call(["/usr/lib/anaconda-runtime/implantisomd5",
+                             "%s.iso" %(self.fs_label,)])
+        else:
+            print >> sys.stderr, "anaconda-runtime not installed; not setting up mediacheck"
+
     def createSquashFS(self):
         """create compressed squashfs file system"""
         if not self.skip_compression:
diff --git a/creator/mayflower b/creator/mayflower
index f483e1e..ed8c731 100755
--- a/creator/mayflower
+++ b/creator/mayflower
@@ -170,6 +170,8 @@ cp /bin/grep bin
 cp /bin/dmesg bin
 cp /sbin/lsmod sbin
 
+# if we have the iso checker, we want it
+[ -x /usr/lib/anaconda-runtime/checkisomd5 ] && cp /usr/lib/anaconda-runtime/checkisomd5 bin
 
 # Copy all required shared libs
 for i in bin/* sbin/* lib/udev/*; do 
@@ -235,6 +237,7 @@ quiet=0
 shell=0
 eshell=0
 live_ram=0
+check_iso=0
 live_locale=""
 
 # Parse kernel commandline options
@@ -265,6 +268,9 @@ for o in \`cat /proc/cmdline\` ; do
     live_locale=*)
         live_locale=\${o#live_locale=}
         ;;
+    check)
+        check_iso=1
+        ;;
     esac
 done
 
@@ -489,6 +495,15 @@ if [ "\$root" != "mtd0" ] ; then
 
 fi
 
+if [ "x\$check_iso" == "x1" -a -x /bin/checkisomd5 -a "x\$rootfstype" == "xiso9660" ]; then
+   /bin/checkisomd5 --verbose /dev/root
+   if [ \$? <= 0 ]; then
+       echo "Are you SURE you want to continue?"
+       echo "Press Enter to continue or ctrl-alt-del to reboot."
+       read
+   fi
+fi 
+
 if [ "x\$root_ro" == "x1" ] ; then
    if [ -z \$rootflags ] ; then
        rootflags="ro"
-- 
1.5.0.6




More information about the Fedora-livecd-list mailing list