Description: lxc-clone: fix wrong handling of lxc.mount
 We can't simply search on and remove 'lxc.mount' entries, as those will
 also hit lxc.mount.entry entries.  Look for 'lxc.mount[ \t]' instead.
 This cherrypicks an upstream fix for lxc-clone, so does not need to be
 forwarded upstream.
Author: Serge Hallyn <serge.hallyn@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1084089
Forwarded: no

Index: lxc-0.7.5/src/lxc/lxc-clone.in
===================================================================
--- lxc-0.7.5.orig/src/lxc/lxc-clone.in	2012-11-29 12:40:22.000000000 -0600
+++ lxc-0.7.5/src/lxc/lxc-clone.in	2012-11-29 12:43:31.035397456 -0600
@@ -146,11 +146,12 @@
 sed -i '/lxc.utsname/d' $lxc_path/$lxc_new/config
 echo "lxc.utsname = $hostname" >> $lxc_path/$lxc_new/config
 
-sed -i '/lxc.mount/d' $lxc_path/$lxc_new/config
-echo "lxc.mount = $lxc_path/$lxc_new/fstab" >> $lxc_path/$lxc_new/config
+grep "lxc.mount[ \t]" $lxc_path/$lxc_new/config >/dev/null 2>&1 && { sed -i '/lxc.mount[ \t]/d' $lxc_path/$lxc_new/config; echo "lxc.mount = $lxc_path/$lxc_new/fstab" >> $lxc_path/$lxc_new/config; }
 
-cp $lxc_path/$lxc_orig/fstab $lxc_path/$lxc_new/fstab
-sed -i "s@$lxc_path/$lxc_orig@$lxc_path/$lxc_new@" $lxc_path/$lxc_new/fstab
+if [ -e  $lxc_path/$lxc_orig/fstab ];then
+    cp $lxc_path/$lxc_orig/fstab $lxc_path/$lxc_new/fstab
+    sed -i "s@$lxc_path/$lxc_orig@$lxc_path/$lxc_new@" $lxc_path/$lxc_new/fstab
+fi
 
 rootfs=$lxc_path/$lxc_new/rootfs
 # First figure out if the old is a device.  For now we only support
