Le jeudi 19 avril 2012 à 19:23 +0200, Frederic Crozat a écrit :
> Le jeudi 19 avril 2012 à 16:09 +0200, Frederic Crozat a écrit :
> > Hi,
> >
> > I'm attaching a patch which contains various fixes in openSUSE
> > template :
> > - creation of x86 templates based on 12.1
> > - lxc-clone fixes
>
> Please use attached patch, I had forgot other fixes from my tree.
And yet another version, because the previous one contained part of the
"alternative config patch" in it.
--
Frederic Crozat <fcro...@suse.com>
SUSE
>From c461f3851dba92f5bf5e8c32d4c0de331fcb4d50 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcro...@suse.com>
Date: Wed, 18 Apr 2012 17:17:18 +0200
Subject: [PATCH] various fixes for openSUSE template: - create /etc/hostname
as symlink to /etc/HOSTNAME (lxc-clone fix) - fix
inadequate space in lxc.mount config (lxc-clone fix) - fix
openSUSE 12.1 template creation on x86 platform - disable
network in container if not configured - configure network
scripts properly
---
templates/lxc-opensuse.in | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 120b2c7..7ea0ac5 100644
--- a/templates/lxc-opensuse.in
+++ b/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
@@ -156,10 +158,11 @@ download_opensuse()
cat > $cache/partial-$arch-packages/opensuse.conf << EOF
Preinstall: aaa_base bash coreutils diffutils
Preinstall: filesystem fillup glibc grep insserv libacl1 libattr1
-Preinstall: libbz2-1 libgcc46 libxcrypt libncurses5 pam
+Preinstall: libbz2-1 libgcc46 libncurses5 pam
Preinstall: permissions libreadline6 rpm sed tar zlib libselinux1
Preinstall: liblzma5 libcap2 libpcre0
Preinstall: libpopt0 libelf1 liblua5_1
+Preinstall: netcfg
RunScripts: aaa_base
@@ -169,9 +172,21 @@ Support: lxc
Prefer: sysvinit-init
Ignore: patterns-openSUSE-base:patterns-openSUSE-yast2_install_wf
+Ignore: patterns-openSUSE-base:polkit-defaults-privs
+Ignore: patterns-openSUSE-base:openSUSE-build-key
EOF
+ if [ "$arch" == "i686" ]; then
+ mkdir -p $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i686/
+ for i in "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i586/*" ; do
+ ln -s $i $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/i686/
+ done
+ mkdir -p $cache/partial-$arch-packages/var/cache/zypp/packages/update/i686
+ for i in "$cache/partial-$arch-packages/var/cache/zypp/packages/update/i586/*" ; do
+ ln -s $i $cache/partial-$arch-packages/var/cache/zypp/packages/update/i686/
+ done
+ fi
- CLEAN_BUILD=1 BUILD_ROOT="$cache/partial-$arch" BUILD_DIST="$cache/partial-$arch-packages/opensuse.conf" /usr/lib/build/init_buildsystem --clean --cachedir $cache/partial-$arch-cache --repository $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch --repository $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch
+ CLEAN_BUILD=1 BUILD_ARCH="$arch" BUILD_ROOT="$cache/partial-$arch" BUILD_DIST="$cache/partial-$arch-packages/opensuse.conf" /usr/lib/build/init_buildsystem --clean --cachedir $cache/partial-$arch-cache --repository $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch --repository $cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch --repository $cache/partial-$arch-packages/var/cache/zypp/packages/update/$arch --repository $cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch
chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar http://download.opensuse.org/distribution/$DISTRO/repo/oss repo-oss
chroot $cache/partial-$arch /usr/bin/zypper --quiet --non-interactive ar http://download.opensuse.org/update/$DISTRO/ update
chroot $cache/partial-$arch rpm -e patterns-openSUSE-base
@@ -254,13 +269,22 @@ copy_configuration()
rootfs=$2
name=$3
+# only disable network if no network configuration was passed
+grep -q lxc.network.type $path/$name/config
+network_not_configured=$?
+if [ $network_not_configured -eq 1 ]; then
+ cat <<EOF >> $path/$name/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
lxc.cgroup.devices.deny = a
# /dev/null and zero
--
1.7.7
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel