[Debian-live-changes] r1331 - in dists/trunk/live-initramfs: doc scripts

Daniel Baumann daniel at alioth.debian.org
Sun May 6 16:46:33 UTC 2007


Author: daniel
Date: 2007-05-06 16:46:32 +0000 (Sun, 06 May 2007)
New Revision: 1331

Modified:
   dists/trunk/live-initramfs/doc/ChangeLog
   dists/trunk/live-initramfs/scripts/live-helpers
Log:


Modified: dists/trunk/live-initramfs/doc/ChangeLog
===================================================================
--- dists/trunk/live-initramfs/doc/ChangeLog	2007-05-06 16:37:39 UTC (rev 1330)
+++ dists/trunk/live-initramfs/doc/ChangeLog	2007-05-06 16:46:32 UTC (rev 1331)
@@ -18,6 +18,9 @@
 	  - Added patch to support multiple filesystem images.
 	* scripts/live-functions:
 	  - Added patch to really export variables from live.vars.
+	* scripts/live-helpers:
+	  - Added patch to support encrypted filesystem images.
+	  - Added patch fo support local keymaps.
 
 2007-05-06  Daniel Baumann  <daniel at debian.org>
 

Modified: dists/trunk/live-initramfs/scripts/live-helpers
===================================================================
--- dists/trunk/live-initramfs/scripts/live-helpers	2007-05-06 16:37:39 UTC (rev 1330)
+++ dists/trunk/live-initramfs/scripts/live-helpers	2007-05-06 16:46:32 UTC (rev 1331)
@@ -108,11 +108,20 @@
     echo "${size}"
 }
 
+load_keymap()
+{
+    # Load custom keymap
+    if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then
+	loadkeys /etc/boottime.kmap.gz
+    fi
+}
+
 setup_loop() {
     local fspath=$1
     local module=$2
     local pattern=$3
     local offset=$4
+    local encryption=$5
 
     modprobe ${MP_QUIET} -b "$module"
     udevsettle
@@ -120,14 +129,39 @@
     for loopdev in $pattern; do
         if [ "$(cat $loopdev/size)" -eq 0 ]; then
             dev=$(sys2dev "${loopdev}")
-            if [ -n "$offset" ]; then
-                losetup -o "$offset" "$dev" "$fspath"
-            else
-                losetup "$dev" "$fspath"
-            fi
-            echo "$dev"
-            return 0
-        fi
+	    options=''
+	    if [ 0 -lt "${offset}" ]; then
+	        options="${options} -o ${offset}"
+	    fi
+	    if [ -z "${encryption}" ]; then
+		losetup ${options} "${dev}" "${fspath}"
+	    else
+		# Loop AES encryption
+		while true; do
+		    load_keymap
+		    echo -n "Enter passphrase for ${fspath}: " >&6
+		    read -s passphrase
+		    echo "${passphrase}" > /tmp/passphrase
+		    exec 9</tmp/passphrase
+		    /sbin/losetup ${options} -e "${encryption}" -p 9 "${dev}" "${fspath}"
+		    error=$?
+		    exec 9<&-
+		    rm -f /tmp/passphrase
+		    if [ 0 -eq ${error} ]; then
+		        unset error
+			break
+		    fi
+		    echo -n "Something went wrong... Retry? [YES/no] " >&6
+		    read answer
+		    if [ 'no' = "${answer}" ]; then
+		    	unset answer
+			break
+		    fi
+		done
+	    fi
+	    echo "$dev"
+	    return 0
+	fi
     done
     panic "No loop devices available"
 }




More information about the Debian-live-changes mailing list