--- recepies/lxc/ve2lxc.sh 2009/05/21 15:55:27 93 +++ recepies/lxc/ve2lxc.sh 2009/06/15 20:22:52 112 @@ -5,7 +5,8 @@ dir=$1 hostname=ve2lxc ip=$2 -netmask=255.255.254.0 +netmask=`grep netmask /etc/network/interfaces | head -1 | sed 's/^.*netmask *//'` +gateway=`grep gateway /etc/network/interfaces | head -1 | sed 's/^.*gateway *//'` test -z "$ip" && ip=10.60.0.253 @@ -45,11 +46,14 @@ iface eth0 inet static address $ip netmask $netmask + gateway $gateway __interfaces__ echo $hostname > $dir/etc/hostname +echo "$ip $hostname" >> $dir/etc/hosts + conf=/tmp/ve2lxc.conf cat << __lxc__ > $conf @@ -81,6 +85,8 @@ lxc.cgroup.devices.allow = c 254:0 rwm __lxc__ +cp -v /etc/resolv.conf /$dir/etc/resolv.conf + mount | grep /cgroup || mount /cgroup || exit lxc-create -n ve2lxc -f $conf && lxc-start -n ve2lxc