File lxc-convert-fix-sle11-rootfs.patch of Package libvirt.239

Index: libvirt-1.2.5/examples/lxcconvert/virt-lxc-convert
===================================================================
--- libvirt-1.2.5.orig/examples/lxcconvert/virt-lxc-convert
+++ libvirt-1.2.5/examples/lxcconvert/virt-lxc-convert
@@ -124,4 +124,21 @@ if test -z "$mem_limit"; then
 fi
 
 virsh -c lxc:/// domxml-from-native lxc-tools $conf_new
-exit $?
+result=$?
+
+# The rootfs for SLE11 guests will need some tweaks to run
+rootfs=$(sed -n "/lxc.rootfs[[:space:]]*=/ s/lxc.rootfs[[:space:]]*=[[:space:]]\(.*\)$/\1/p" "$conf_new")
+if test -d $rootfs; then
+    if test -w $rootfs/etc/init.d/boot; then
+        sed -i 's/"lxc"/"lxc-libvirt"/' $rootfs/etc/init.d/boot
+    fi
+
+    if test -w $rootfs/etc/securetty && \
+       test -z "$(grep 'pts/0' $rootfs/etc/securetty)"; then
+        echo "pts/0" >> $rootfs/etc/securetty
+    fi
+else
+    echo "Root file system $rootfs doesn't exist" >&2
+    result=1
+fi
+exit $result
openSUSE Build Service is sponsored by