From 7a9fe7af17c77db96ea51db95ee87a6b34fc330c Mon Sep 17 00:00:00 2001
From: Andreas Loibl <andreas@andreas-loibl.de>
Date: Fri, 18 Mar 2011 22:45:58 +0100
Subject: loop-device and fstab fixes

---
 backend/modules/hdmap        | 25 +++++++++++++++++++++++++
 backend/modules/init         |  5 ++++-
 backend/modules/install_main |  2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/backend/modules/hdmap b/backend/modules/hdmap
index d57d105..3056b93 100644
--- a/backend/modules/hdmap
+++ b/backend/modules/hdmap
@@ -338,3 +338,28 @@ function prepare_partitions_for_install()
 		progress=$[progress+1]; emit_progress $[100*progress/progress_steps]
 	done <<<"$cfg_hdmap"
 }
+
+function get_full_hd_map()
+{
+        (
+                echo "$cfg_hdmap"
+		root_disk="$(get_disk "$(hdmap_get device of mountpoint /)")"
+                for part in $(list_all_partitions)
+                do
+                        if is_removeable "$part" && [ "$(get_disk "$part")" != "$root_disk" ]; then
+                                echo "$part:::"
+                        else
+                                echo "$part:/media/$(basename "$part")::auto"
+                        fi
+                done
+                for part in $(list_linux_partitions)
+                do
+                        if is_removeable "$part" && [ "$(get_disk "$part")" != "$root_disk" ]; then
+                                echo "$part:::"
+                        else
+                                echo "$part:/media/$(basename "$part")::auto"
+                        fi
+                done
+        ) | sort -u -t: -k1,1
+}
+
diff --git a/backend/modules/init b/backend/modules/init
index f7a7628..cfe37e1 100644
--- a/backend/modules/init
+++ b/backend/modules/init
@@ -5,7 +5,10 @@ function init_installer()
 	[ -f /etc/default/distro ] && . /etc/default/distro
 	export FLL_DISTRO_MODE FLL_DISTRO_NAME FLL_LIVE_USER
 	mkdir -p /live/filesystem
-	[ -d /live/filesystem/usr ] || mount -o ro /dev/loop0 /live/filesystem
+	if [ ! -d /live/filesystem/usr ]; then
+		LOOPDEV="$(losetup --all | awk -F: '/\/live\/image\/live/&&/filesystem/{print $1}')"
+		[ "$LOOPDEV" ] && mount -o ro "$LOOPDEV" /live/filesystem
+	fi
 	cfg_set hostname "${FLL_DISTRO_NAME}Box"
 }
 
diff --git a/backend/modules/install_main b/backend/modules/install_main
index bee41af..efe775f 100644
--- a/backend/modules/install_main
+++ b/backend/modules/install_main
@@ -38,6 +38,8 @@ EOF
 
 	while IFS=: read device mountpoint filesystem automount
 	do
+		[ -z "$mountpoint" ] && continue
+
 		fstab_options=""; fstab_dump=0; fstab_pass=2; fstab_type=""
 		[ -z "$fstab_type" ] && fstab_type=$filesystem
 		[ -z "$fstab_type" ] && fstab_type=$(get_filesystem $device)
-- 
cgit v1.0