gitian-builder/libexec/start-target

38 lines
838 B
Plaintext
Raw Normal View History

2011-01-30 21:12:02 +00:00
#!/bin/sh
. gconfig
2011-02-01 07:50:59 +00:00
ARCH=qemu$1
SUFFIX=$2
2013-02-08 16:50:34 +00:00
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
case $ARCH in
qemu32)
[ -n "$KVM" ] || KVM=qemu-system-i386
;;
qemu64)
[ -n "$KVM" ] || KVM=qemu-system-x86_64
;;
esac
2013-04-14 23:21:12 +00:00
$KVM -enable-kvm -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 &
2012-04-22 05:44:00 +00:00
echo $! > var/target.pid
wait
rm var/target.pid
2013-02-08 16:50:34 +00:00
;;
LXC)
2012-04-22 05:44:00 +00:00
true #sudo lxc-start -n gitian -c var/target.log -f lxc.config
2013-02-08 16:50:34 +00:00
;;
VBOX)
VBoxManage startvm "Gitian-${2}" # --type headless
echo "Gitian-${2}" > var/target.vmname
;;
esac