summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2012-12-20 01:46:06 +0100
committerHolger Levsen <holger@layer-acht.org>2012-12-20 01:46:06 +0100
commitd5f14e4d48f22d9edcae2b483e635d1efb6f75ee (patch)
treec55e65ac8a1d79ca5c2c931800b2f4f3dbf5becf
parent85f3b4c22854000d54b447623f9e393280ecdc1b (diff)
downloadjenkins.debian.net-d5f14e4d48f22d9edcae2b483e635d1efb6f75ee.tar.xz
grep for vnc=$DISPLAY when killing qemu as all system will have a display, while not all will use preseeding
-rwxr-xr-xbin/g-i-installation.sh39
1 files changed, 19 insertions, 20 deletions
diff --git a/bin/g-i-installation.sh b/bin/g-i-installation.sh
index 1e9bcf9e..f21d1edc 100755
--- a/bin/g-i-installation.sh
+++ b/bin/g-i-installation.sh
@@ -64,6 +64,16 @@ fetch_if_newer() {
cleanup_all() {
set +x
set +e
+ #
+ # kill qemu
+ #
+ sudo kill -9 $(ps fax | grep [q]emu-system | grep vnc=$DISPLAY 2>/dev/null | awk '{print $1}') || true
+ sleep 0.3s
+ rm $WORKSPACE/$NAME.raw
+ #
+ # cleanup image mount
+ #
+ sudo umount -l $IMAGE_MNT &
cd $RESULTS
echo -n "Last screenshot: "
if [ -f snapshot_000000.ppm ] ; then
@@ -84,19 +94,7 @@ cleanup_all() {
convert $i ${i%.ppm}.png
rm $i
done
-
fi
- set -x
- #
- # kill qemu and image
- #
- sudo kill -9 $(ps fax | grep [q]emu-system | grep ${NAME}_preseed.cfg 2>/dev/null | awk '{print $1}') || true
- sleep 0.3s
- rm $WORKSPACE/$NAME.raw
- #
- # cleanup
- #
- sudo umount -l $IMAGE_MNT
}
show_preseed() {
@@ -111,15 +109,15 @@ bootstrap_system() {
echo "Creating raw disk image with ${DISKSIZE_IN_GB} GiB now."
qemu-img create -f raw $NAME.raw ${DISKSIZE_IN_GB}G
echo "Doing g-i installation test for $NAME now."
- # qemu related variables (incl kernel+initrd)
+ # qemu related variables (incl kernel+initrd) - display first, as we grep for this in the process list
+ QEMU_OPTS="-display vnc=$DISPLAY -no-shutdown"
if [ -n "$IMAGE" ] ; then
- QEMU_OPTS="-cdrom $IMAGE -boot d"
+ QEMU_OPTS="$QEMU_OPTS -cdrom $IMAGE -boot d"
QEMU_KERNEL="--kernel $IMAGE_MNT/install.amd/vmlinuz --initrd $IMAGE_MNT/install.amd/gtk/initrd.gz"
else
QEMU_KERNEL="--kernel $KERNEL --initrd $INITRD"
fi
QEMU_OPTS="$QEMU_OPTS -drive file=$NAME.raw,index=0,media=disk,cache=writeback -m $RAMSIZE"
- QEMU_OPTS="$QEMU_OPTS -display vnc=$DISPLAY -no-shutdown"
QEMU_WEBSERVER=http://10.0.2.2/
# preseeding related variables
PRESEED_PATH=d-i-preseed-cfgs
@@ -160,9 +158,9 @@ bootstrap_system() {
boot_system() {
cd $WORKSPACE
echo "Booting system installed with g-i installation test for $NAME."
- # qemu related variables (incl kernel+initrd)
- QEMU_OPTS="-drive file=$NAME.raw,index=0,media=disk,cache=writeback -m $RAMSIZE"
- QEMU_OPTS="$QEMU_OPTS -display vnc=$DISPLAY -no-shutdown"
+ # qemu related variables (incl kernel+initrd) - display first, as we grep for this in the process list
+ QEMU_OPTS="-display vnc=$DISPLAY -no-shutdown"
+ QEMU_OPTS="$QEMU_OPTS -drive file=$NAME.raw,index=0,media=disk,cache=writeback -m $RAMSIZE"
echo
echo "Starting QEMU_ now:"
(sudo qemu-system-x86_64 \
@@ -361,7 +359,7 @@ case $JOB_NAME in
*) #
# kill qemu and image
#
- sudo kill -9 $(ps fax | grep [q]emu-system | grep ${NAME}_preseed.cfg 2>/dev/null | awk '{print $1}') || true
+ sudo kill -9 $(ps fax | grep [q]emu-system | grep vnc=$DISPLAY 2>/dev/null | awk '{print $1}') || true
if [ ! -z "$IMAGE" ] ; then
sudo umount -l $IMAGE_MNT || true
fi
@@ -369,7 +367,8 @@ case $JOB_NAME in
monitor_system normal
;;
esac
-
cleanup_all
+
+# don't cleanup twice
trap - INT TERM EXIT