-
Notifications
You must be signed in to change notification settings - Fork 310
/
Copy pathtest_qemu.sh
executable file
·67 lines (51 loc) · 1.68 KB
/
test_qemu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
set -e
mkdir -p minimal_overlay/rootfs/etc/autorun
cat << CEOF > minimal_overlay/rootfs/etc/autorun/99_autoshutdown.sh
#!/bin/sh
# This script shuts down the OS automatically.
sleep 10 && poweroff &
echo " Minimal Linux Live will shut down in 10 seconds."
CEOF
chmod +x minimal_overlay/rootfs/etc/autorun/99_autoshutdown.sh
cat <<CEOF > minimal_boot/bios/boot/syslinux/syslinux.cfg
SERIAL 0
DEFAULT operatingsystem
LABEL operatingsystem
LINUX /boot/kernel.xz
APPEND console=tty0 console=ttyS0
INITRD /boot/rootfs.xz
CEOF
./repackage.sh
qemu-system-x86_64 -m 256M -cdrom minimal_linux_live.iso -boot d -localtime -nographic &
sleep 5
if [ "`ps -ef | grep -i [q]emu-system`" = "" ] ; then
echo "`date` | !!! FAILURE !!! Minimal Linux Live is not running in QEMU."
exit 1
else
echo "`date` | Minimal Linux Live is running in QEMU. Waiting for automatic shutdown."
fi
RETRY=10
while [ ! "$RETRY" = "0" ] ; do
echo "`date` | Countdown: $RETRY"
if [ "`ps -ef | grep -i [q]emu-system`" = "" ] ; then
break
fi
sleep 30
RETRY=$(($RETRY - 1))
done
if [ "`ps -ef | grep -i [q]emu-system`" = "" ] ; then
echo "`date` | Minimal Linux Live is not running in QEMU."
else
echo "`date` | !!! FAILURE !!! Minimal Linux Live is still running in QEMU."
exit 1
fi
cat << CEOF
##################################################################
# #
# QEMU test passed. Clean manually the affected MLL artifacts. #
# #
##################################################################
CEOF
echo "`date` | *** MLL QEMU test - END ***"
set +e