38 lines
838 B
Bash
Executable File
38 lines
838 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)
|
|
case $ARCH in
|
|
qemu32)
|
|
[ -n "$KVM" ] || KVM=qemu-system-i386
|
|
;;
|
|
qemu64)
|
|
[ -n "$KVM" ] || KVM=qemu-system-x86_64
|
|
;;
|
|
esac
|
|
$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 &
|
|
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
|