Skip to content

Commit ea3536e

Browse files
paulzholbradfitz
authored andcommitted
env/freebsd-amd64: add FreeBSD 11.0 image, change 10.1 to 10.3
Verify checksum of downloaded image files. Set cache=none on image disk. Updates: golang/go#19097 Change-Id: Icae149fa9772f038b8946ee680f36e4e6f3db516 Reviewed-on: https://go-review.googlesource.com/37389 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 300c0ef commit ea3536e

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

env/freebsd-amd64/make.bash

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,43 @@
88
# an ISO mounted as the CD-ROM, and customizes the system before powering down.
99
# SSH is enabled, and a user gopher, password gopher, is created.
1010

11-
# Only tested on Ubuntu 14.04.
11+
# Only tested on Ubuntu 16.04.
1212
# Requires packages: qemu expect mkisofs
1313

1414
set -e
1515

16+
function download_image() {
17+
local release_url=ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/${VERSION:?}-RELEASE/amd64/Latest
18+
local img_filename=FreeBSD-${VERSION:?}-RELEASE-amd64${VERSION_TRAILER}.raw.xz
19+
curl -O ${release_url}/${img_filename}
20+
echo "${SHA256} ${img_filename}" | sha256sum -c -
21+
xz -d FreeBSD-${VERSION:?}-RELEASE-amd64${VERSION_TRAILER}.raw.xz
22+
}
23+
1624
case $1 in
1725
9.3)
1826
readonly VERSION=9.3
1927
readonly VERSION_TRAILER="-20140711-r268512"
2028
readonly DNS_LOOKUP=dig
29+
readonly SHA256=4737218995ae056207c68f3105c0fbe655c32e8b76d2160ebfb1bba56dd5196f
2130
;;
2231

23-
10.1)
24-
if [ -z $1 ]; then
25-
echo "No version specified, defaulting to 10.1"
26-
fi
27-
readonly VERSION=10.1
32+
10.3)
33+
readonly VERSION=10.3
2834
readonly VERSION_TRAILER=
2935
# BIND replaced by unbound on FreeBSD 10, so drill(1) is the new dig(1)
3036
readonly DNS_LOOKUP=drill
37+
readonly SHA256=1d710ba643bf6a8ce5bff5a9d69b1657ccff83dd1f2df711d9b4e02f9aab7d06
38+
;;
39+
11.0)
40+
readonly VERSION=11.0
41+
readonly VERSION_TRAILER=
42+
readonly DNS_LOOKUP=drill
43+
readonly SHA256=f9f7fcac1acfe210979a72e0642a70fcf9c9381cc1884e966eac8381c724158c
3144
;;
3245
*)
3346
echo "Usage: $0 <version>"
34-
echo " version - FreeBSD version to build. Valid choices: 9.3 10.1"
47+
echo " version - FreeBSD version to build. Valid choices: 9.3 10.3 11.0"
3548
exit 1
3649
esac
3750

@@ -43,8 +56,7 @@ if [ $(tput cols) -lt 80 ]; then
4356
fi
4457

4558
if ! [ -e FreeBSD-${VERSION:?}-RELEASE-amd64.raw ]; then
46-
curl -O ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/${VERSION:?}-RELEASE/amd64/Latest/FreeBSD-${VERSION:?}-RELEASE-amd64${VERSION_TRAILER}.raw.xz
47-
xz -d FreeBSD-${VERSION:?}-RELEASE-amd64${VERSION_TRAILER}.raw.xz
59+
download_image
4860
fi
4961

5062
cp FreeBSD-${VERSION:?}-RELEASE-amd64${VERSION_TRAILER}.raw disk.raw
@@ -117,7 +129,7 @@ sleep 2
117129
# TODO(wathiede): set serial output so we can track boot on GCE.
118130
expect <<EOF
119131
set timeout 600
120-
spawn qemu-system-x86_64 -display curses -smp 2 -drive if=virtio,file=disk.raw -cdrom config.iso -net nic,model=virtio -net user
132+
spawn qemu-system-x86_64 -display curses -smp 2 -drive if=virtio,file=disk.raw,cache=none -cdrom config.iso -net nic,model=virtio -net user
121133
122134
# Speed-up boot by going in to single user mode.
123135
expect "Welcome to FreeBSD"

0 commit comments

Comments
 (0)