-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_and_run
executable file
·76 lines (60 loc) · 1.92 KB
/
build_and_run
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
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -e -o pipefail
# Copyright (C) 2019 Gunter Miegel coinboot.io
#
# This file is part of Coinboot.
#
# Coinboot is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
export RELEASE=$(date +'%Y%m%d')
export VERSION='0.98 Beta'
run_qemu() {
zram=$1
qemu-system-x86_64 \
-kernel build/coinboot-vmlinuz-${KERNEL} \
-initrd build/coinboot-initramfs-${KERNEL} \
-m 2048 \
-smp 4 \
-display none \
-daemonize \
-net user,hostfwd=tcp::2222-:22 \
-net nic \
-append "console=ttyS0 \
[email protected]/eth0,[email protected]/9c:4a:c7:7a:a1:7a \
net.ifnames=0 \
biosdevname=0 \
break=skip_loading_plugins \
$zram"
}
verify_over_ssh() {
while ! nc -z 127.0.0.1 2222; do
echo 'Waiting for Coinboot machine to listen on port 2222/SSH ...'
sleep 10
done
while ! sshpass -p ubuntu ssh -o StrictHostKeyChecking=no -l ubuntu -p 2222 localhost "grep -C 10 $RELEASE /etc/motd && lsb_release -a && uname -a && zramctl" ; do
echo 'Waiting for SSH login to succeed...'
sleep 10
done
killall qemu-system-x86_64
while nc -z 192.168.1.10 22; do
echo 'Waiting for Coinboot machine to stop listen on port 22/SSH ...'
sleep 10
done
}
sudo apt-get update
sudo apt-get install --yes qemu-system-x86 ipxe-qemu sshpass
docker-compose up
run_qemu
verify_over_ssh
run_qemu zram
verify_over_ssh