This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathbuild-usb.bash
81 lines (65 loc) · 1.89 KB
/
build-usb.bash
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
#!/bin/bash
set -e
# Download Plan 9
if [ ! -e 9legacy.iso ] && [ ! -e 9legacy.iso.bz2 ]; then
curl -L --fail -O https://github.com/Harvey-OS/harvey/releases/download/9legacy/9legacy.iso.bz2
fi
if [ ! -e 9legacy.iso ]; then
bunzip2 -k 9legacy.iso.bz2
fi
# Get the Go program source fetched
(cd ../sys/src/cmd/go && sh fetchrepos.sh)
# Make directories as needed
(cd ..; bash ./build/mkdirs)
rm -f harvey.tgz
(cd ..; tar --format ustar --exclude './build' --exclude harvey.tgz --exclude .git --exclude '9legacy.iso*' -czf harvey.tgz *)
FLAG_KVM=""
case $(uname -s) in
"Linux") FLAG_KVM="-accel kvm" ;;
esac
expect <<EOF
spawn qemu-system-i386 $FLAG_KVM -nographic -net user -net nic,model=virtio -m 4096 -vga none -cdrom 9legacy.iso -boot d -hda ../harvey.tgz
expect -exact "Selection:"
send "2\n"
expect -exact "Plan 9"
sleep 5
expect -timeout 600 "root is from (tcp, local)"
send "local\n"
expect -exact "mouseport is (ps2, ps2intellimouse, 0, 1, 2)\[ps2\]:"
send "ps2intellimouse\n"
expect -re "vgasize .*:"
send "1280x1024x32\n"
expect -re "monitor is .*:"
send "vesa\n"
# Mount the host's fileserver
#expect -exact "term% "
#send "9fs tcp!10.0.2.2!5640 /n/harvey\n"
set timeout 2400
# 9fs is fucking slow, so let's be stupid
expect -exact "term% "
send "ramfs -u -m /n/harvey\n"
expect -exact "term% "
send "ramfs -u -m /tmp\n"
expect -exact "term% "
send "cd /n/harvey\n"
expect -exact "term% "
send "gunzip < /dev/sdC0/data | tar x\n"
expect -exact "term% "
send "srv -c tcp!10.0.2.2!5640 host /n/host\n"
expect -exact "term% "
send "bind -a /n/harvey/sys/go/bin/plan9_386 /bin\n"
# Go to the build dir
expect -exact "term% "
send "cd /n/harvey/build/scripts\n"
# build usb first
expect -exact "term% "
send "rc build && rc repl && rc usb\n"
expect -exact "term% "
send "ls -l /n/host/\n"
# and shut down
expect -exact "term% "
send "fshalt\n"
expect -exact "done halting"
exit
EOF
rm ../harvey.tgz