You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitian-builder/libexec/stop-target

34 lines
603 B
Bash

#!/bin/sh
VMSW=KVM
if [ -n "$USE_LXC" ]; then
VMSW=LXC
elif [ -n "$USE_VBOX" ]; then
VMSW=VBOX
fi
case $VMSW in
KVM)
if [ ! -e var/target.pid ]; then exit; fi
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
echo Killing target since it did not shutdown within 10 seconds
kill `cat var/target.pid`
;;
LXC)
true
;;
VBOX)
if [ ! -e var/target.vmname ]; then exit; fi
VBoxManage controlvm `cat var/target.vmname` savestate
rm var/target.vmname
;;
esac