[SCM] Debian Live initramfs hook branch, master, updated. 1.154.1-1-2-g21883c0

Marco Amadori amadorim at vdavda.com
Tue Dec 2 17:00:07 UTC 2008


The following commit has been merged in the master branch:
commit c20af1c3158c0d41f9ed77943d5f63480addef33
Author: Marco Amadori <amadorim at vdavda.com>
Date:   Tue Dec 2 08:57:48 2008 +0100

    Reworked integrity-check (Closes: #507477).
    
    * Changes:
    
     - it reboots only if it succeed, otherwise it panics.
     - it checks md5sum just after media is mounted, not after /root is
       mounted. This allow a faster and safer reboot.
    
    Signed-off-by: Marco Amadori <amadorim at vdavda.com>

diff --git a/scripts/live b/scripts/live
index 389fc21..eb279f6 100755
--- a/scripts/live
+++ b/scripts/live
@@ -109,6 +109,11 @@ Arguments ()
 				export IGNORE_UUID
 				;;
 
+			integrity-check)
+				INTEGRITY_CHECK="Yes"
+				export INTEGRITY_CHECK
+				;;
+
 			ip=*)
 				STATICIP="${ARGUMENT#ip=}"
 
@@ -1426,6 +1431,32 @@ set_usplash_timeout ()
 	fi ; fi
 }
 
+integrity_check ()
+{
+	media_mountpoint="${1}"
+
+	log_begin_msg "Checking media integrity"
+
+	cd ${media_mountpoint}
+	/bin/md5sum -c md5sum.txt < /dev/tty8 > /dev/tty8
+	RC="${?}"
+
+	log_end_msg
+
+	if [ "${RC}" -eq 0 ]
+	then
+		log_success_msg "Everything ok, will reboot in 10 seconds."
+		sleep 10
+		cd /
+		umount ${media_mountpoint}
+		sync
+		echo u > /proc/sysrq-trigger
+		echo b > /proc/sysrq-trigger
+	else
+		panic "Not ok, a media defect is likely, switch to VT8 for details."
+	fi
+}
+
 mountroot ()
 {
         if [ -x /scripts/local-top/cryptroot ]; then
@@ -1492,6 +1523,11 @@ mountroot ()
 		panic "Unable to find a medium containing a live file system"
 	fi
 
+	if [ "${INTEGRITY_CHECK}" ]
+	then
+		integrity_check "${livefs_root}"
+	fi
+
 	if [ "${TORAM}" ]
 	then
 		live_dest="ram"
diff --git a/scripts/live-bottom/01integrity_check b/scripts/live-bottom/01integrity_check
deleted file mode 100755
index e4710f3..0000000
--- a/scripts/live-bottom/01integrity_check
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-#set -e
-
-# initramfs-tools header
-
-PREREQ=""
-
-prereqs()
-{
-	echo "${PREREQ}"
-}
-
-case "${1}" in
-	prereqs)
-		prereqs
-		exit 0
-		;;
-esac
-
-# live-initramfs script
-
-if grep -qs integrity-check /proc/cmdline
-then
-	cd /live/image
-	md5sum -c md5sum.txt < /dev/tty8 > /dev/tty8
-	reboot
-	while :; do sleep 60; done
-fi

-- 
Debian Live initramfs hook



More information about the debian-live-changes mailing list