First pass lxc support
parent
8e161f4e6c
commit
28bb421156
@ -0,0 +1,32 @@
|
||||
lxc.tty = 4
|
||||
lxc.pts = 1024
|
||||
lxc.rootfs = ROOTFS
|
||||
lxc.arch = ARCH
|
||||
lxc.cgroup.devices.deny = a
|
||||
# /dev/null and zero
|
||||
lxc.cgroup.devices.allow = c 1:3 rwm
|
||||
lxc.cgroup.devices.allow = c 1:5 rwm
|
||||
# consoles
|
||||
lxc.cgroup.devices.allow = c 5:1 rwm
|
||||
lxc.cgroup.devices.allow = c 5:0 rwm
|
||||
lxc.cgroup.devices.allow = c 4:0 rwm
|
||||
lxc.cgroup.devices.allow = c 4:1 rwm
|
||||
# /dev/{,u}random
|
||||
lxc.cgroup.devices.allow = c 1:9 rwm
|
||||
lxc.cgroup.devices.allow = c 1:8 rwm
|
||||
lxc.cgroup.devices.allow = c 136:* rwm
|
||||
lxc.cgroup.devices.allow = c 5:2 rwm
|
||||
# rtc
|
||||
lxc.cgroup.devices.allow = c 254:0 rwm
|
||||
|
||||
# mounts points
|
||||
lxc.mount.entry=proc ROOTFS/proc proc nodev,noexec,nosuid 0 0
|
||||
lxc.mount.entry=sysfs ROOTFS/sys sysfs defaults 0 0
|
||||
|
||||
# Container with network virtualized using a pre-configured bridge named br0 and
|
||||
# veth pair virtual network devices
|
||||
# On the host, run: ifconfig br0 up 10.0.2.2
|
||||
lxc.network.type = veth
|
||||
lxc.network.flags = up
|
||||
lxc.network.link = br0
|
||||
lxc.network.ipv4 = 10.0.2.5/24
|
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
wd=`pwd`
|
||||
sed "s;ROOTFS;$wd/target-$LXC_SUITE-$LXC_ARCH-root;;s;ARCH;$LXC_ARCH;g" < etc/lxc.config.in > var/lxc.config
|
@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
SUITE=lucid
|
||||
ARCH=amd64
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [OPTION]..."
|
||||
echo "Make a clean copy of the base client."
|
||||
echo
|
||||
cat << EOF
|
||||
--help display this help and exit
|
||||
--suite U build suite U instead of lucid
|
||||
--arch A build architecture A (e.g. i386) instead of amd64
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ $# != 0 ] ; then
|
||||
while true ; do
|
||||
case "$1" in
|
||||
--help|-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--suite|-s)
|
||||
SUITE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--arch|-a)
|
||||
ARCH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--*)
|
||||
echo "unrecognized option $1"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
BASE=base-$SUITE-$ARCH-root
|
||||
OUT=target-$SUITE-$ARCH-root
|
||||
|
||||
if [ -z "$USE_LXC" ]; then
|
||||
cp $BASE.qcow2 $OUT.qcow2
|
||||
else
|
||||
sudo rm -rf $OUT
|
||||
sudo cp -a $BASE $OUT
|
||||
on-target -u root useradd -m ubuntu
|
||||
fi
|
@ -1,14 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -e var/target.pid ]; then exit; fi
|
||||
if [ -z "$USE_LXC" ]; then
|
||||
if [ ! -e var/target.pid ]; then exit; fi
|
||||
|
||||
on-target -u root halt
|
||||
sleep 5
|
||||
on-target -u root halt
|
||||
sleep 5
|
||||
|
||||
if [ ! -e var/target.pid ]; then exit; fi
|
||||
sleep 5
|
||||
if [ ! -e var/target.pid ]; then exit; fi
|
||||
sleep 5
|
||||
|
||||
if [ ! -e var/target.pid ]; then exit; fi
|
||||
if [ ! -e var/target.pid ]; then exit; fi
|
||||
|
||||
echo Killing target since it did not shutdown within 10 seconds
|
||||
kill `cat var/target.pid`
|
||||
echo Killing target since it did not shutdown within 10 seconds
|
||||
kill `cat var/target.pid`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
Loading…
Reference in New Issue