[lxc-devel] [GIT] lxc branch, master, updated. 5fad0874c3ff58afeb5c427a7ef1d211d3c5ce37

2010-06-01 Thread Daniel Lezcano
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project lxc.

The branch, master has been updated
   via  5fad0874c3ff58afeb5c427a7ef1d211d3c5ce37 (commit)
  from  0e391e57b0e463720b956cf0fa515e861027c4b0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
commit 5fad0874c3ff58afeb5c427a7ef1d211d3c5ce37
Author: Daniel Lezcano dlezc...@fr.ibm.com
Date:   Tue Jun 1 12:24:17 2010 +0200

fix compilation warning

Fix compilation warning:

lxc_console.c: In function ‘master_handler’:
lxc_console.c:175: warning: ignoring return value of ‘write’, declared 
with attribute warn_unused_result

Signed-off-by: Daniel Lezcano dlezc...@fr.ibm.com

---

Summary of changes:
 src/lxc/lxc_console.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
lxc

--

___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH 1/4] ubunutu template

2010-06-01 Thread Daniel Lezcano
From: Willem Meier wilhelm.me...@fh-kl.de

Ubuntu [lucid] template script.
Allows to create an ubuntu container with the template options.

Signed-off-by: Willem Meier wilhelm.me...@fh-kl.de
Signed-off-by: Daniel Lezcano dlezc...@fr.ibm.com
---
 configure.ac  |1 +
 scripts/Makefile.am   |1 +
 scripts/lxc-ubuntu.in |  327 +
 3 files changed, 329 insertions(+), 0 deletions(-)
 create mode 100644 scripts/lxc-ubuntu.in

diff --git a/configure.ac b/configure.ac
index e91f69e..1df6ab5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,6 +135,7 @@ AC_CONFIG_FILES([
 
scripts/Makefile
scripts/lxc-debian
+   scripts/lxc-ubuntu
scripts/lxc-busybox
scripts/lxc-fedora
scripts/lxc-sshd
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 803a8e0..39d13a3 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,5 +1,6 @@
 bin_SCRIPTS = \
lxc-debian \
+   lxc-ubuntu \
lxc-fedora \
lxc-busybox \
lxc-sshd
diff --git a/scripts/lxc-ubuntu.in b/scripts/lxc-ubuntu.in
new file mode 100644
index 000..592385e
--- /dev/null
+++ b/scripts/lxc-ubuntu.in
@@ -0,0 +1,327 @@
+#!/bin/bash
+
+#
+# template script for generating ubuntu/lucid container for LXC
+#
+# This script is based on lxc-debian (Daniel Lezcano daniel.lezc...@free.fr)
+#
+
+# Copyright © 2010 Wilhelm Meier
+# Author: Wilhelm Meier wilhelm.me...@fh-kl.de
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2, as
+# published by the Free Software Foundation.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+configure_ubuntu()
+{
+rootfs=$1
+hostname=$2
+
+# disable selinux in ubuntu
+mkdir -p $rootfs/selinux
+echo 0  $rootfs/selinux/enforce
+
+   # configure the network using the dhcp
+cat EOF  $rootfs/etc/network/interfaces
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet dhcp
+EOF
+
+# set the hostname
+cat EOF  $rootfs/etc/hostname
+$hostname
+EOF
+# set minimal hosts
+cat EOF  $rootfs/etc/hosts
+127.0.0.1 localhost $hostname
+EOF
+
+# provide the lxc service
+cat EOF  $rootfs/etc/init/lxc.conf
+# fake some events needed for correct startup other services
+
+description Container Upstart
+
+start on startup
+
+script
+rm -rf /var/run/*
+/sbin/initctl emit stopped JOB=udevtrigger
+/sbin/initctl emit started JOB=udev
+end script
+EOF
+
+cat EOF  $rootfs/lib/init/fstab
+# /lib/init/fstab: lxc system fstab
+none/spu  spufs   gid=spu,optional 
 0 0
+none/tmp  nonedefaults 
 0 0
+none/var/run  tmpfs   
mode=0755,nosuid,showthrough  0 0
+none/var/lock tmpfs   
nodev,noexec,nosuid,showthrough   0 0
+none/lib/init/rw  tmpfs   
mode=0755,nosuid,optional 0 0
+EOF
+
+# reconfigure some services
+chroot $rootfs locale-gen de_DE.UTF-8
+
+# remove pointless services in a container
+chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove
+
+chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do echo 
$f; mv $f $f.orig; done'
+chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); 
do echo $f; mv $f $f.orig; done'
+chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); 
do echo $f; mv $f $f.orig; done'
+chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); 
do echo $f; mv $f $f.orig; done'
+chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do 
echo $f; mv $f $f.orig; done'
+
+echo Please change root-password !
+
+echo root:root | chroot /usr/local/var/lib/lxc/test/rootfs chpasswd
+}
+
+download_ubuntu()
+{
+
packages=dialog,apt,resolvconf,iproute,inetutils-ping,vim,dhcp3-client,ssh,lsb-release
+
+cache=$1
+arch=$2
+
+# check the mini ubuntu was not already downloaded
+mkdir -p $cache/partial-$arch
+if [ $? -ne 0 ]; then
+   echo Failed to create '$cache/partial-$arch' directory
+   return 1
+fi
+
+# download a mini ubuntu into a cache
+echo Downloading ubuntu minimal ...
+debootstrap --verbose --variant=minbase --components=main,universe 
--arch=$arch --include=$packages lucid $cache/partial-$arch
+if [ $? -ne 0 

[lxc-devel] [PATCH 2/4] Fix ubuntu template

2010-06-01 Thread Daniel Lezcano
From: Daniel Lezcano daniel.lezc...@free.fr

 - Fixed rootfs path.
 - Removed network section, it should to be passed to the lxc-create
configuration option in order to concatenate the configuration files
 - Generate en_US local instead of de_DE

Signed-off-by: Daniel Lezcano dlezc...@fr.ibm.com
---
 scripts/lxc-ubuntu.in |   16 +---
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/scripts/lxc-ubuntu.in b/scripts/lxc-ubuntu.in
index 592385e..835da0a 100644
--- a/scripts/lxc-ubuntu.in
+++ b/scripts/lxc-ubuntu.in
@@ -75,7 +75,7 @@ none/lib/init/rw  tmpfs   
mode=0755,nosuid,optio
 EOF
 
 # reconfigure some services
-chroot $rootfs locale-gen de_DE.UTF-8
+chroot $rootfs locale-gen en_US.UTF-8
 
 # remove pointless services in a container
 chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove
@@ -86,9 +86,10 @@ EOF
 chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); 
do echo $f; mv $f $f.orig; done'
 chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do 
echo $f; mv $f $f.orig; done'
 
-echo Please change root-password !
+echo root:root | chroot $rootfs chpasswd
+echo Root password is 'root', please change !
 
-echo root:root | chroot /usr/local/var/lib/lxc/test/rootfs chpasswd
+return 0
 }
 
 download_ubuntu()
@@ -181,16 +182,9 @@ copy_configuration()
 rootfs=$2
 name=$3
 
-cat EOF  $path/config
-# Container with network virtualized using the macvlan device driver
+cat EOF  $path/config
 lxc.utsname = $name
 
-lxc.network.type = macvlan
-lxc.network.flags = up
-lxc.network.link = eth1
-lxc.network.hwaddr = 4a:49:43:49:79:03
-lxc.network.macvlan.mode = vepa
-
 lxc.tty = 4
 lxc.pts = 1024
 lxc.rootfs = $rootfs
-- 
1.7.0.4


--

___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


[lxc-devel] [PATCH 4/4] fix busybox template

2010-06-01 Thread Daniel Lezcano
Fix various bug with the busybox template:
 * add a warning when busybox is not statically linked
 * delete the password for root (chpasswd is not available for all busybox)
 * add the new pts option

Signed-off-by: Daniel Lezcano dlezc...@fr.ibm.com
---
 scripts/lxc-busybox.in |   14 --
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/lxc-busybox.in b/scripts/lxc-busybox.in
index 40542d5..5f04dd8 100644
--- a/scripts/lxc-busybox.in
+++ b/scripts/lxc-busybox.in
@@ -26,6 +26,7 @@ install_busybox()
 name=$2
 res=0
 tree=\
+$rootfs/selinux \
 $rootfs/dev \
 $rootfs/home \
 $rootfs/root \
@@ -191,6 +192,13 @@ configure_busybox()
return 1
 fi
 
+file $(which busybox) | grep -q statically linked
+if [ $? -ne 0 ]; then
+   echo warning : busybox is not statically linked.
+   echo warning : The template script may not correctly
+   echo warning : setup the container environment.
+fi
+
 # copy busybox in the rootfs
 cp $(which busybox) $rootfs/bin
 if [ $? -ne 0 ]; then
@@ -206,9 +214,10 @@ configure_busybox()
 
 # passwd exec must be setuid
 chmod +s $rootfs/bin/passwd
+touch $rootfs/etc/shadow
+chroot $rootfs /bin/passwd -d root
 
-echo root:root | chroot $rootfs chpasswd
-echo Root password is 'root', please change !
+echo No password for 'root', please change !
 
 return 0
 }
@@ -222,6 +231,7 @@ copy_configuration()
 cat EOF  $path/config
 lxc.utsname = $name
 lxc.tty = 1
+lxc.pts = 1
 lxc.rootfs = $rootfs
 EOF
 
-- 
1.7.0.4


--

___
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel


Re: [lxc-devel] template-script for ubuntu [lucid] containers

2010-06-01 Thread Wilhelm

Am 01.06.2010 16:06, schrieb Daniel Lezcano:

On 06/01/2010 06:04 PM, Daniel Lezcano wrote:

On 05/30/2010 07:07 PM, Wilhelm wrote:

Hi,

for all interested: attached you'll find a template script for ubuntu
containers.


Hi Willem,

thanks a lot for the script, I fixed some nasty things but I was happy
to play with it :)

Do you mind to modify the script in order to have '/var/tmp' not being


sorry, I meant '/var/run'


ok, changed it in the attached script (and added the patches you posted 
and some other tweaks)




mounted as a tmpfs, so the mechanism within lxc can 'shutdown' /
'reboot' properly ?
but a halt from inside the container isn't handled properly: the 
init-process still remains ...

Any ideas?


Thanks
-- Daniel



--
Wilhelm

#!/bin/bash

#
# template script for generating ubuntu/lucid container for LXC
#
# This script is based on lxc-debian (Daniel Lezcano daniel.lezc...@free.fr)
#

# Copyright © 2010 Wilhelm Meier
# Author: Wilhelm Meier wilhelm.me...@fh-kl.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

configure_ubuntu()
{
rootfs=$1
hostname=$2

# disable selinux in ubuntu
mkdir -p $rootfs/selinux
echo 0  $rootfs/selinux/enforce

   # configure the network using the dhcp
cat EOF  $rootfs/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF

# set the hostname
cat EOF  $rootfs/etc/hostname
$hostname
EOF
# set minimal hosts
cat EOF  $rootfs/etc/hosts
127.0.0.1 localhost $hostname
EOF

# provide the lxc service 
cat EOF  $rootfs/etc/init/lxc.conf
# fake some events needed for correct startup other services

description Container Upstart

start on startup

script
rm -rf /var/run/*.pid
rm -rf /var/run/network/*
/sbin/initctl emit stopped JOB=udevtrigger --no-wait
/sbin/initctl emit started JOB=udev --no-wait
end script
EOF

cat EOF  $rootfs/lib/init/fstab
# /lib/init/fstab: lxc system fstab
none/spu  spufs   gid=spu,optional  
0 0
none/tmp  nonedefaults  
0 0
#none/var/run  tmpfs   
mode=0755,nosuid,showthrough  0 0
none/var/lock tmpfs   
nodev,noexec,nosuid,showthrough   0 0
none/lib/init/rw  tmpfs   
mode=0755,nosuid,optional 0 0
EOF

# reconfigure some services
if [ -z $LANG ]; then
chroot $rootfs locale-gen en_US.UTF-8
chroot $rootfs update-locale LANG=en_US.UTF-8
else
chroot $rootfs locale-gen $LANG
chroot $rootfs update-locale LANG=$LANG
fi

# remove pointless services in a container
chroot $rootfs /usr/sbin/update-rc.d -f ondemand remove

chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls u*.conf); do mv $f 
$f.orig; done'
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls tty[2-9].conf); do 
mv $f $f.orig; done'
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls plymouth*.conf); 
do mv $f $f.orig; done'
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls hwclock*.conf); do 
mv $f $f.orig; done'
chroot $rootfs /bin/bash -c 'cd /etc/init; for f in $(ls module*.conf); do 
mv $f $f.orig; done'

echo Please change root-password !
echo root:root | chroot $rootfs chpasswd

return 0
}

download_ubuntu()
{

packages=dialog,apt,apt-utils,resolvconf,iproute,inetutils-ping,vim,dhcp3-client,ssh,lsb-release

cache=$1
arch=$2

# check the mini ubuntu was not already downloaded
mkdir -p $cache/partial-$arch
if [ $? -ne 0 ]; then
echo Failed to create '$cache/partial-$arch' directory
return 1
fi

# download a mini ubuntu into a cache
echo Downloading ubuntu minimal ...
debootstrap --verbose --variant=minbase --components=main,universe 
--arch=$arch --include=$packages lucid $cache/partial-$arch
if [ $? -ne 0 ]; then
echo Failed to download the rootfs, aborting.
return 1
fi

mv $1/partial-$arch $1/rootfs-$arch
echo Download complete.

return 0
}

copy_ubuntu()
{
cache=$1
arch=$2
rootfs=$3

# make a local copy of the miniubuntu
echo -n Copying rootfs to $rootfs ...
cp -a $cache/rootfs-$arch $rootfs || return 1
return