#!/bin/sh
cd /var/lib/lxc
for box in `ls -d lxc-*`
do
echo "settings for $box"
echo $box > $box/root/etc/hostname
echo "give last byte of IP-address (192.168.1. 21 - 29)"
read ip
cat > $box/root/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
 address 192.168.1.$ip
 netmask 255.255.255.0
 gateway 192.168.1.1
EOF
cat > $box/root/etc/resolve.conf <<EOF2
nameserver <your resolving dns server here>
nameserver <your resolving dns server here>
EOF2
# edit password
ed -s $box/root/etc/shadow <<EOF3
/^root/c
root:<your crypted string here>:14716:0:99999:7:::
.
wq
EOF3
# edit $box/config file
ed -s $box/config <<EOF4
/lxc.utsname/c
lxc.utsname = $box
.
/lxc.rootfs/c
lxc.rootfs = /var/lib/lxc/$box/root/
.
wq
EOF4
done