gitian-builder/libexec/start-target
2013-04-09 07:12:04 +00:00

31 lines
675 B
Bash
Executable File

#!/bin/sh
. gconfig
ARCH=qemu$1
SUFFIX=$2
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
[ -n "$KVM" ] || KVM=kvm
$KVM -cpu $ARCH -m ${VMEM:-2000} -smp ${NPROCS:-2} -drive file=target-$SUFFIX.qcow2,cache=writeback -net nic,model=virtio -net user,hostfwd=tcp:127.0.0.1:$VM_SSH_PORT-:22 -vnc 127.0.0.1:16 > var/target.log 2>&1 &
echo $! > var/target.pid
wait
rm var/target.pid
;;
LXC)
true #sudo lxc-start -n gitian -c var/target.log -f lxc.config
;;
VBOX)
VBoxManage startvm "Gitian-${2}" # --type headless
echo "Gitian-${2}" > var/target.vmname
;;
esac