-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootkeys.sh
More file actions
executable file
·92 lines (74 loc) · 1.9 KB
/
bootkeys.sh
File metadata and controls
executable file
·92 lines (74 loc) · 1.9 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# LiveG OS Bootstrap Toolchain
#
# Copyright (C) LiveG. All Rights Reserved.
#
# https://liveg.tech/os
# Licensed by the LiveG Open-Source Licence, which can be found at LICENCE.md.
# This code injects keystrokes into the QEMU VM to launch setup with preseed
# file without user input. It's called by `boot.sh`.
function monitorexec {
echo "Sending key: $1"
# echo $1 | socat - TCP:127.0.0.1:8001 STDIO
echo $1 | nc 127.0.0.1 8001 -w 0
}
function typein {
for (( i = 0; i < ${#1}; i++ )); do
char=${1:$i:1}
case $char in
" ")
monitorexec "sendkey spc"
;;
"=")
monitorexec "sendkey equal"
;;
":")
monitorexec "sendkey shift-semicolon"
;;
"-")
monitorexec "sendkey minus"
;;
"_")
monitorexec "sendkey shift-minus"
;;
"/")
monitorexec "sendkey slash"
;;
".")
monitorexec "sendkey dot"
;;
*)
monitorexec "sendkey $char"
;;
esac
done
}
if [ $PLATFORM = "arm64" ]; then
sleep 7
monitorexec "sendkey c"
sleep 1
typein "linux /install.a64/vmlinuz \
auto-install/enable=true \
netcfg/get_hostname=debian \
netcfg/get_domain=debian "
sleep 1
typein "\
preseed/url=http://10.0.2.2:8000/preseed.cfg \
cdrom-detect/load_media=false \
cdrom-detect/manual_config=true \
--- quiet"
sleep 1
monitorexec "sendkey ret"
typein "initrd /install.a64/initrd.gz"
monitorexec "sendkey ret"
typein "boot"
sleep 1
monitorexec "sendkey ret"
else
sleep 4
monitorexec "sendkey esc"
sleep 1
typein "auto url=http://10.0.2.2:8000/preseed.cfg"
sleep 1
monitorexec "sendkey ret"
fi