--- tools/boot/squeeze/boot-x86~	2011-02-22 20:52:44.000000000 +0000
+++ tools/boot/squeeze/boot-x86	2013-04-25 12:50:20.000000000 +0000
@@ -269,17 +269,14 @@
 
 if [ -z "$MULTIARCH" ]; then
 	# Set up isolinux dir for only the current arch
-	sed -i "s|%install%|$INSTALLDIR|" \
-		boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg
+	grep -lr '%install%' boot$N/isolinux/* | xargs -r sed -i "s|%install%|$INSTALLDIR|"
     
 	# Remove the amd*.cfg files to avoid them being loaded on a
 	# disc that does not have both amd64 and i386 dirs.
-	rm -f boot$N/isolinux/amd*.cfg boot$N/isolinux/desktop/amd*.cfg
+	find boot$N/isolinux/ -name "amd*.cfg" -delete
 else
 	# Set up isolinux dir for multi-arch
-	sed -i "s|%install%|$INSTALLDIR_i386|
-			s|%install-amd%|$INSTALLDIR_amd64|" \
-			    boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg
+	grep -lr '%install[-amd]*%' boot$N/isolinux/* | xargs -r sed -i -e "s|%install%|$INSTALLDIR_i386|" -e "s|%install-amd%|$INSTALLDIR_amd64|"
 
 	for file in boot$N/isolinux/f3.txt* boot$N/isolinux/f4.txt*; do
 		sed -i "4 s/^$/(note: i386 is default; prepend 'amd64-' to use an amd64 kernel instead)/" $file
--- tools/boot/squeeze/x86-desktop.sh~	2009-05-31 23:53:55.000000000 +0000
+++ tools/boot/squeeze/x86-desktop.sh	2013-04-25 12:59:18.000000000 +0000
@@ -22,8 +22,10 @@
 		boot$N/isolinux/amdtxt.cfg || true
 	sed -i "/^include menu.cfg/ a\include instsel.cfg" \
 		boot$N/isolinux/prompt.cfg
-	sed -i "/^default install/ a\include instsel.cfg" \
-		boot$N/isolinux/desktop/prompt.cfg
+	if [ -e boot$N/isolinux/desktop/prompt.cfg ]; then
+		sed -i "/^default install/ a\include instsel.cfg" \
+			boot$N/isolinux/desktop/prompt.cfg
+	fi
 	cat >boot$N/isolinux/instsel.cfg <<EOF
 default install-select
 label install-select
@@ -48,8 +50,8 @@
 
 modify_for_single_desktop() {
 	# Cleanup
-	rm boot$N/isolinux/dtmenu.cfg
-	rm -r boot$N/isolinux/desktop
+	rm -f boot$N/isolinux/dtmenu.cfg
+	rm -fr boot$N/isolinux/desktop
 
 	# Set default desktop, or remove if not applicable
 	if [ "$DESKTOP" ]; then
--- tools/boot/wheezy/boot-x86~	2013-03-24 20:13:25.000000000 +0000
+++ tools/boot/wheezy/boot-x86	2013-04-25 12:00:42.000000000 +0000
@@ -284,17 +284,14 @@
 
 if [ -z "$MULTIARCH" ]; then
 	# Set up isolinux dir for only the current arch
-	sed -i "s|%install%|$INSTALLDIR|" \
-		boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg
+	grep -lr '%install%' boot$N/isolinux/* | xargs -r sed -i "s|%install%|$INSTALLDIR|"
     
 	# Remove the amd*.cfg files to avoid them being loaded on a
 	# disc that does not have both amd64 and i386 dirs.
-	rm -f boot$N/isolinux/amd*.cfg boot$N/isolinux/desktop/amd*.cfg
+	find boot$N/isolinux/ -name "amd*.cfg" -delete
 else
 	# Set up isolinux dir for multi-arch
-	sed -i "s|%install%|$INSTALLDIR_i386|
-			s|%install-amd%|$INSTALLDIR_amd64|" \
-			    boot$N/isolinux/*.cfg boot$N/isolinux/desktop/*.cfg
+	grep -lr '%install[-amd]*%' boot$N/isolinux/* | xargs -r sed -i -e "s|%install%|$INSTALLDIR_i386|" -e "s|%install-amd%|$INSTALLDIR_amd64|"
 
 	for file in boot$N/isolinux/f3.txt* boot$N/isolinux/f4.txt*; do
 		sed -i "4 s/^$/(note: i386 is default; prepend 'amd64-' to use an amd64 kernel instead)/" $file
--- tools/boot/wheezy/x86-desktop.sh~	2009-05-31 23:53:55.000000000 +0000
+++ tools/boot/wheezy/x86-desktop.sh	2013-04-25 11:54:58.000000000 +0000
@@ -22,8 +22,10 @@
 		boot$N/isolinux/amdtxt.cfg || true
 	sed -i "/^include menu.cfg/ a\include instsel.cfg" \
 		boot$N/isolinux/prompt.cfg
-	sed -i "/^default install/ a\include instsel.cfg" \
-		boot$N/isolinux/desktop/prompt.cfg
+	if [ -e boot$N/isolinux/desktop/prompt.cfg ]; then
+		sed -i "/^default install/ a\include instsel.cfg" \
+			boot$N/isolinux/desktop/prompt.cfg
+	fi
 	cat >boot$N/isolinux/instsel.cfg <<EOF
 default install-select
 label install-select
@@ -48,8 +50,8 @@
 
 modify_for_single_desktop() {
 	# Cleanup
-	rm boot$N/isolinux/dtmenu.cfg
-	rm -r boot$N/isolinux/desktop
+	rm -f boot$N/isolinux/dtmenu.cfg
+	rm -fr boot$N/isolinux/desktop
 
 	# Set default desktop, or remove if not applicable
 	if [ "$DESKTOP" ]; then
