[SCM] live-boot branch, debian-next, updated. debian/3.0_a28-1-9-g6fb264b

Daniel Baumann daniel at debian.org
Tue Jun 5 13:59:21 UTC 2012


The following commit has been merged in the debian-next branch:
commit 6fb264bde675d42843696eb5c859e55d3198a2e2
Author: Daniel Baumann <daniel at debian.org>
Date:   Tue Jun 5 15:59:20 2012 +0200

    Converting read-only initramfs-tools pre-mount script into regular live-boot script.

diff --git a/initramfs-tools/scripts/live-premount/readonly b/initramfs-tools/scripts/live-premount/readonly
deleted file mode 100755
index 71483bd..0000000
--- a/initramfs-tools/scripts/live-premount/readonly
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-#set -e
-
-# initramfs-tools header
-
-PREREQ="udev"
-
-prereqs()
-{
-	echo "${PREREQ}"
-}
-
-case "${1}" in
-	prereqs)
-		prereqs
-		exit 0
-		;;
-esac
-
-# live-boot script
-
-# make sure all harddisk devices are read-only
-# this is important for forensic investigations
-if grep -qe forensic -qe readonly /proc/cmdline
-then
-	for device in /dev/hd* /dev/sd* /dev/vd*
-	do
-		if [ -b "$device" ]
-		then
-			printf " * Setting device %-9s to read-only mode: " $device >/dev/console
-			blockdev --setro $device && printf "done [ execute \"blockdev --setrw %-9s\" to unlock]\n" $device >/dev/console || printf "failed\n" >/dev/console
-		fi
-	done
-fi
diff --git a/scripts/boot.sh b/scripts/boot.sh
index 5a64d70..eeaa4dc 100755
--- a/scripts/boot.sh
+++ b/scripts/boot.sh
@@ -472,6 +472,14 @@ mountroot ()
 
 	Arguments
 
+	# make sure all harddisk devices are read-only
+	# this is important for forensic investigations
+	case "${READ_ONLY}" in
+		true)
+			Read_only
+			;;
+	esac
+
 	maybe_break live-premount
 	log_begin_msg "Running /scripts/live-premount"
 	run_scripts /scripts/live-premount
diff --git a/scripts/boot/arguments.sh b/scripts/boot/arguments.sh
index 6b4e553..c526b9a 100755
--- a/scripts/boot/arguments.sh
+++ b/scripts/boot/arguments.sh
@@ -10,6 +10,10 @@ Arguments ()
 	for ARGUMENT in $(cat /proc/cmdline)
 	do
 		case "${ARGUMENT}" in
+			read-only)
+				READ_ONLY="true"
+				;;
+
 			skipconfig)
 				NOACCESSIBILITY="Yes"
 				NOFASTBOOT="Yes"
diff --git a/scripts/boot/read-only.sh b/scripts/boot/read-only.sh
new file mode 100755
index 0000000..c8990df
--- /dev/null
+++ b/scripts/boot/read-only.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#set -e
+
+Read_only ()
+{
+	# Marking the usual block devices for harddisks read-only
+	for _DEVICE in /dev/sd* /dev/vd*
+	do
+		if [ -b "${_DEVICE}" ]
+		then
+			printf "Setting device %-9s to read-only mode:" ${_DEVICE} > /dev/console
+
+			blockdev --setro ${_DEVICE} && printf " done [ execute \"blockdev --setrw %-9s\" to unlock]\n" ${_DEVICE} > /dev/console || printf "failed\n" > /dev/console
+		fi
+	done
+}

-- 
live-boot



More information about the debian-live-changes mailing list