|
6 | 6 | # Builds FreeBSD image based on raw disk images provided by FreeBSD.org
|
7 | 7 | # This script boots the image once, side-loads GCE Go builder configuration via
|
8 | 8 | # an ISO mounted as the CD-ROM, and customizes the system before powering down.
|
9 |
| -# SSH is enabled, and a user gopher, password gopher, is created. |
| 9 | +# SSH is enabled, and a user swarming, password swarming, is created. |
10 | 10 |
|
11 | 11 | # Only tested on Ubuntu 20.04.
|
12 | 12 | # Requires packages: qemu-system-x86 qemu-img expect genisoimage
|
@@ -99,9 +99,15 @@ case $1 in
|
99 | 99 | readonly SHA256=7b8fcc2330c8d9f66dd012c5859167d56c227ece39188c8f55b2bddbf688875f # https://lists.freebsd.org/archives/freebsd-snapshots/2021-December/000036.html
|
100 | 100 | readonly BLIND_SWITCH_CONSOLE=1
|
101 | 101 | ;;
|
| 102 | +14.1) |
| 103 | + readonly VERSION=14.1-RELEASE |
| 104 | + readonly VERSION_TRAILER= |
| 105 | + readonly SHA256=f2eb6f0033e573f580d43f0cf5a0e9c17c6994de9e502c711fd2325dac3b8f69 |
| 106 | + readonly BLIND_SWITCH_CONSOLE=1 |
| 107 | +;; |
102 | 108 | *)
|
103 | 109 | echo "Usage: $0 <version>"
|
104 |
| - echo " version - FreeBSD version to build. Valid choices: 9.3 10.3 10.4 11.0 11.1 11.2 11.3 11.4 12.0 12.1 12.2 13.0 13.0-SNAPSHOT" |
| 110 | + echo " version - FreeBSD version to build. Valid choices: 9.3 10.3 10.4 11.0 11.1 11.2 11.3 11.4 12.0 12.1 12.2 13.0 13.0-SNAPSHOT 14.1" |
105 | 111 | exit 1
|
106 | 112 | esac
|
107 | 113 |
|
|
120 | 126 |
|
121 | 127 | qemu-img create -f qcow2 -b FreeBSD-${VERSION:?}-amd64${VERSION_TRAILER}.raw -F raw disk.qcow2 16G
|
122 | 128 |
|
123 |
| -mkdir -p iso/boot iso/etc iso/usr/local/etc/rc.d |
| 129 | +mkdir -p iso/boot iso/etc iso/usr/local/etc/rc.d iso/usr/local/bin |
124 | 130 | cp loader.conf iso/boot
|
125 | 131 | cp rc.conf iso/etc
|
126 | 132 | cp sysctl.conf iso/etc
|
127 | 133 | cp buildlet iso/usr/local/etc/rc.d
|
| 134 | +CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -o iso/usr/local/bin/bootstrapswarm golang.org/x/build/cmd/bootstrapswarm |
128 | 135 |
|
129 | 136 | cat >iso/install.sh <<'EOF'
|
130 | 137 | #!/bin/sh
|
131 | 138 | set -x
|
132 | 139 |
|
133 |
| -mkdir -p /usr/local/etc/rc.d/ |
| 140 | +mkdir -p /usr/local/etc/rc.d/ /usr/local/bin/ |
134 | 141 | cp /mnt/usr/local/etc/rc.d/buildlet /usr/local/etc/rc.d/buildlet
|
135 | 142 | chmod +x /usr/local/etc/rc.d/buildlet
|
136 | 143 | cp /mnt/boot/loader.conf /boot/loader.conf
|
137 | 144 | cp /mnt/etc/rc.conf /etc/rc.conf
|
| 145 | +cp /mnt/usr/local/bin/bootstrapswarm /usr/local/bin/bootstrapswarm |
138 | 146 | cat /mnt/etc/sysctl.conf >> /etc/sysctl.conf
|
139 | 147 | adduser -f - <<ADDUSEREOF
|
140 |
| -gopher::::::Gopher Gopherson::/bin/sh:gopher |
| 148 | +swarming::::::Swarming Gopher Gopherson::/bin/sh:swarming |
141 | 149 | ADDUSEREOF
|
142 |
| -pw user mod gopher -G wheel |
| 150 | +pw user mod swarming -G wheel |
143 | 151 |
|
144 | 152 | # Enable serial console early in boot process.
|
145 | 153 | echo '-h' > /boot.conf
|
@@ -238,7 +246,7 @@ if {$::env(DOWNLOAD_UPDATES)} {
|
238 | 246 |
|
239 | 247 | expect -re $prompt
|
240 | 248 | sleep 1
|
241 |
| -send "pkg install -y bash curl git gdb\n" |
| 249 | +send "pkg install -y bash curl git gdb python\n" |
242 | 250 |
|
243 | 251 | expect -re $prompt
|
244 | 252 | send "sync\n"
|
|
0 commit comments