|
|
@ -74,7 +74,13 @@ if [ $ARCH = "amd64" -a $SUITE = "hardy" ]; then
|
|
|
|
FLAVOUR=server
|
|
|
|
FLAVOUR=server
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
addpkg=openssh-server,pciutils,build-essential,git-core,subversion,lxc,linux-image-generic
|
|
|
|
addpkg=pciutils,build-essential,git-core,subversion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $LXC = "1" ]; then
|
|
|
|
|
|
|
|
addpkg=$addpkg,lxc
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
addpkg=$addpkg,linux-image-generic,grub-pc,openssh-server
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Remove cron to work around vmbuilder issue when umounting /dev on target
|
|
|
|
# Remove cron to work around vmbuilder issue when umounting /dev on target
|
|
|
|
removepkg=cron
|
|
|
|
removepkg=cron
|
|
|
@ -99,26 +105,40 @@ if [ $VBOX = "1" ]; then
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e $OUT.qcow2 ]; then
|
|
|
|
if [ $LXC = "1" ]; then
|
|
|
|
echo $OUT.qcow2 already exists, please remove it first
|
|
|
|
if [ -e $OUT ]; then
|
|
|
|
exit 1
|
|
|
|
echo $OUT already exists, please remove it first
|
|
|
|
|
|
|
|
#exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if [ -e $OUT.qcow2 ]; then
|
|
|
|
|
|
|
|
echo $OUT.qcow2 already exists, please remove it first
|
|
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
libexec/config-bootstrap-fixup
|
|
|
|
|
|
|
|
rm -rf $OUT
|
|
|
|
|
|
|
|
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo vmbuilder kvm ubuntu --rootsize 10240 --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=`pwd`/target-bin/bootstrap-fixup
|
|
|
|
|
|
|
|
mv $OUT/*.qcow2 $OUT.qcow2
|
|
|
|
|
|
|
|
rm -rf $OUT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $LXC = "1" ]; then
|
|
|
|
if [ $LXC = "1" ]; then
|
|
|
|
#sudo debootstrap --include=$addpkg --arch=$ARCH $SUITE $OUT-root $MIRROR
|
|
|
|
sudo rm -rf $OUT-bootstrap
|
|
|
|
echo Extracting partition for lxc
|
|
|
|
# Need universe for lxc in lucid
|
|
|
|
qemu-img convert $OUT.qcow2 $OUT.raw
|
|
|
|
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo debootstrap --arch=$ARCH --include=$addpkg --exclude=$removepkg --components=main,universe $SUITE $OUT-bootstrap $MIRROR
|
|
|
|
loop=`sudo kpartx -av $OUT.raw|sed -n '/loop.p1/{s/.*loop\(.\)p1.*/\1/;p}'`
|
|
|
|
dd if=/dev/zero of=$OUT-lxc bs=1M count=1 seek=10240
|
|
|
|
sudo cp --sparse=always /dev/mapper/loop${loop}p1 $OUT
|
|
|
|
mkfs.ext4 $OUT-lxc
|
|
|
|
sudo chown $USER $OUT
|
|
|
|
t=`mktemp -d gitian.XXXXXXXX`
|
|
|
|
sudo kpartx -d /dev/loop$loop
|
|
|
|
sudo mount $OUT-lxc $t
|
|
|
|
rm -f $OUT.raw
|
|
|
|
sudo cp -a $OUT-bootstrap/* $t
|
|
|
|
|
|
|
|
sudo umount $t
|
|
|
|
|
|
|
|
rmdir $t
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo rm -rf $OUT-bootstrap
|
|
|
|
|
|
|
|
mv $OUT-lxc $OUT
|
|
|
|
# bootstrap-fixup is done in libexec/make-clean-vm
|
|
|
|
# bootstrap-fixup is done in libexec/make-clean-vm
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
libexec/config-bootstrap-fixup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm -rf $OUT
|
|
|
|
|
|
|
|
env -i LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 sudo vmbuilder kvm ubuntu --rootsize 10240 --arch=$ARCH --suite=$SUITE --addpkg=$addpkg --removepkg=$removepkg --ssh-key=var/id_dsa.pub --ssh-user-key=var/id_dsa.pub --mirror=$MIRROR --security-mirror=$SECURITY_MIRROR --dest=$OUT --flavour=$FLAVOUR --firstboot=`pwd`/target-bin/bootstrap-fixup
|
|
|
|
|
|
|
|
mv $OUT/*.qcow2 $OUT.qcow2
|
|
|
|
|
|
|
|
rm -rf $OUT
|
|
|
|
|
|
|
|
# bootstrap-fixup is done on first boot
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|