gitian-builder/libexec/stop-target

34 lines
603 B
Plaintext
Raw Normal View History

2011-01-30 21:12:02 +00:00
#!/bin/sh
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)
2012-04-22 05:44:00 +00:00
if [ ! -e var/target.pid ]; then exit; fi
2011-01-30 21:12:02 +00:00
2012-04-22 05:44:00 +00:00
on-target -u root halt
sleep 5
2011-01-30 21:12:02 +00:00
2012-04-22 05:44:00 +00:00
if [ ! -e var/target.pid ]; then exit; fi
sleep 5
2011-01-30 21:12:02 +00:00
2012-04-22 05:44:00 +00:00
if [ ! -e var/target.pid ]; then exit; fi
2011-01-30 21:12:02 +00:00
2012-04-22 05:44:00 +00:00
echo Killing target since it did not shutdown within 10 seconds
kill `cat var/target.pid`
2013-02-08 16:50:34 +00:00
;;
LXC)
2012-04-22 05:44:00 +00:00
true
2013-02-08 16:50:34 +00:00
;;
VBOX)
if [ ! -e var/target.vmname ]; then exit; fi
VBoxManage controlvm `cat var/target.vmname` savestate
rm var/target.vmname
;;
esac