File lxc-opensuse-clonefixes.patch of Package lxc

From 094f7c36e3ac80be9eb3b1746560965377256467 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 18 Apr 2012 17:17:18 +0200
Subject: [PATCH] various fixes for openSUSE template for lxc-clone usage

- create /etc/hostname as symlink to /etc/HOSTNAME
- fix inadequate space in lxc.mount config, preventing lxc-clone to work
---
 templates/lxc-opensuse.in |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Index: lxc-0.8.0/templates/lxc-opensuse.in
===================================================================
--- lxc-0.8.0.orig/templates/lxc-opensuse.in
+++ lxc-0.8.0/templates/lxc-opensuse.in
@@ -34,8 +34,8 @@ configure_opensuse()
 
    # set network as static, but everything is done by LXC outside the container
    cat <<EOF > $rootfs/etc/sysconfig/network/ifcfg-eth0
-STARTMODE='auto'
-BOOTPROTO='static'
+STARTMODE='manual'
+BOOTPROTO='none'
 EOF
 
    # set default route
@@ -71,6 +71,8 @@ EOF
     cat <<EOF > $rootfs/etc/HOSTNAME
 $hostname
 EOF
+    # ensure /etc/hostname is available too
+    ln -s -f HOSTNAME $rootfs/etc/hostname
 
     # do not use hostname from HOSTNAME variable
     cat <<EOF >> $rootfs/etc/sysconfig/cron
@@ -257,13 +259,22 @@ copy_configuration()
     rootfs=$2
     name=$3
 
+# only disable network if no network configuration was passed
+grep -q lxc.network.type $path/config
+network_not_configured=$?
+if [ $network_not_configured -eq 1 ]; then
+   cat <<EOF >> $path/config
+lxc.network.type = empty
+EOF
+fi
+
     cat <<EOF >> $path/config
 lxc.utsname = $name
 
 lxc.tty = 4
 lxc.pts = 1024
 lxc.rootfs = $rootfs
-lxc.mount  = $path/fstab
+lxc.mount = $path/fstab
 
 # When using LXC with apparmor, uncomment the next line to run unconfined:
 #lxc.aa_profile = unconfined
openSUSE Build Service is sponsored by