From 7761f507f88ade7f5b6aa1f8666e299bf3e1855c Mon Sep 17 00:00:00 2001
From: Ian Reinhart Geiser <geiseri@yahoo.com>
Date: Sun, 29 Apr 2012 15:45:35 -0400
Subject: [PATCH] Clean rofslist paths.  busybox mount -o move fails when you have multiple directory separators in a row.  Also we want to setup the rofs_dest_backing when we are using unionfs.

---
 scripts/live         |    2 +-
 scripts/live-helpers |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/live b/scripts/live
index feb2615..d4184be 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1171,7 +1171,7 @@ setup_unionfs ()
 	if true #[ -n "${SHOWMOUNTS}" ] || ( [ -n "${PERSISTENCE}" ] && [ -z "${NOPERSISTENCE}" ] 1)
 	then
 		# XXX: is the for loop really necessary? rofslist can only contain one item (see above XXX about EXPOSEDROOT) and this is also assumed elsewhere above (see use of $rofs above).
-		for d in ${rofslist}
+		for d in $( echo ${rofslist} | sed "s|//|/|g")
 		do
 			live_rofs="/live/rofs/${d##*/}"
 			live_rofs_list="${live_rofs_list} ${live_rofs}"
diff --git a/scripts/live-helpers b/scripts/live-helpers
index 1913fe9..04edb7e 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -1472,7 +1472,7 @@ activate_custom_mounts ()
 		# XXX: If CONFIG_AUFS_ROBR is added to the Debian kernel we can
 		# ignore the loop below and set rofs_dest_backing=$dest
 		local rofs_dest_backing=""
-		if [ -n "${opt_link}"]
+		if [ -n "${opt_union}" ] || [ -n "${opt_link}" ]
 		then
 			for d in /live/rofs/*
 			do
-- 
1.7.0.4

