env: update openbsd-{386,amd64} builder images to OpenBSD 5.8
OpenBSD 5.8 is the current release and OpenBSD 5.6 is no longer supported.
Revise build script:
- Use the auto installer and disklabel templates built into later versions of
OpenBSD, rather than entirely using expect.
- Rather than duplicating the entire script for openbsd-386, provide an ARCH
environment variable that switches between openbsd/amd64 and openbsd/i386.
Have the openbsd-386 script invoke the openbsd-amd64 script with the
appropriate environment.
- Remove the 'ignore classless-static-routes' option for dhclient, as it is
no longer needed for OpenBSD 5.7 and later.
- Clean up after ourselves, rather than leaving a bunch of temporary files
lying around.
Updates issue golang/go#13029.
Change-Id: Ic1b11dd5eded317b7be32b8f1c2485617ac02b78
Reviewed-on: https://go-review.googlesource.com/18358
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 48bf459..9b4b234 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -115,8 +115,8 @@
"freebsd-amd64-gce101",
"windows-386-gce",
"windows-amd64-gce",
- "openbsd-386-gce56",
- "openbsd-amd64-gce56",
+ "openbsd-386-gce58",
+ "openbsd-amd64-gce58",
"plan9-386",
"nacl-386",
"nacl-amd64p32",
diff --git a/dashboard/builders.go b/dashboard/builders.go
index c867c2d..94457e3 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -24,7 +24,7 @@
Notes string // notes for humans
Owner string // e.g. "bradfitz@golang.org", empty means golang-dev
- VMImage string // e.g. "openbsd-amd64-56"
+ VMImage string // e.g. "openbsd-amd64-58"
KubeImage string // e.g. "linux-buildlet-std:latest" (suffix after "gcr.io/<PROJ>/")
machineType string // optional GCE instance type
Go14URL string // URL to built Go 1.4 tar.gz
@@ -169,7 +169,7 @@
case "darwin-amd64-10_10",
"freebsd-386-gce101", "freebsd-amd64-gce101",
"linux-386", "linux-amd64", "linux-amd64-nocgo",
- "openbsd-386-gce56", "openbsd-amd64-gce56",
+ "openbsd-386-gce58", "openbsd-amd64-gce58",
"plan9-386",
"windows-386-gce", "windows-amd64-gce":
return true
@@ -413,19 +413,19 @@
env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOOS=nacl", "GOARCH=amd64p32", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
})
addBuilder(BuildConfig{
- Name: "openbsd-amd64-gce56",
- Notes: "OpenBSD 5.6; GCE VM is built from script in build/env/openbsd-amd64",
- VMImage: "openbsd-amd64-56",
+ Name: "openbsd-amd64-gce58",
+ Notes: "OpenBSD 5.8; GCE VM is built from script in build/env/openbsd-amd64",
+ VMImage: "openbsd-amd64-58",
machineType: "n1-highcpu-2",
- Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-openbsd-amd64.tar.gz",
+ Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-openbsd-amd64-gce58.tar.gz",
NumTestHelpers: 3,
})
addBuilder(BuildConfig{
- Name: "openbsd-386-gce56",
- Notes: "OpenBSD 5.6; GCE VM is built from script in build/env/openbsd-386",
- VMImage: "openbsd-386-56",
+ Name: "openbsd-386-gce58",
+ Notes: "OpenBSD 5.8; GCE VM is built from script in build/env/openbsd-386",
+ VMImage: "openbsd-386-58",
machineType: "n1-highcpu-2",
- Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-openbsd-386.tar.gz",
+ Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-openbsd-386-gce58.tar.gz",
NumTestHelpers: 3,
})
addBuilder(BuildConfig{
diff --git a/env/openbsd-386/.gitignore b/env/openbsd-386/.gitignore
index c05bc10..f8f5d41 100644
--- a/env/openbsd-386/.gitignore
+++ b/env/openbsd-386/.gitignore
@@ -1,9 +1,10 @@
+auto_install.conf
boot.conf
disk.raw
+disklabel.template
etc
install.site
-install56-patched.iso
-install56.iso
+install*.iso
+openbsd-*-gce.tar.gz
random.seed
-site56.tgz
-openbsd-386-gce.tar.gz
+site58.tgz
diff --git a/env/openbsd-386/README b/env/openbsd-386/README
index 9ce1996..508eda5 100644
--- a/env/openbsd-386/README
+++ b/env/openbsd-386/README
@@ -1,3 +1 @@
-This is a copy of ../openbsd-amd64, but changing "amd64" to "i386".
-
-It's possible they could be combined, but they're not.
+See ../openbsd-amd64/README.
diff --git a/env/openbsd-386/make.bash b/env/openbsd-386/make.bash
index a0dee28..00358d9 100755
--- a/env/openbsd-386/make.bash
+++ b/env/openbsd-386/make.bash
@@ -4,224 +4,6 @@
# license that can be found in the LICENSE file.
set -e
+set -u
-# Download kernel, sets, etc. from ftp.usa.openbsd.org
-if ! [ -e install56.iso ]; then
- curl -O ftp://ftp.usa.openbsd.org/pub/OpenBSD/5.6/i386/install56.iso
-fi
-
-# XXX: Download and save bash, curl, and their dependencies too?
-# Currently we download them from the network during the install process.
-
-# Create custom site56.tgz set.
-mkdir -p etc
-cat >install.site <<EOF
-#!/bin/sh
-env PKG_PATH=ftp://ftp.usa.openbsd.org/pub/OpenBSD/5.6/packages/i386 pkg_add -iv bash curl git
-
-# See https://code.google.com/p/google-compute-engine/issues/detail?id=77
-echo "ignore classless-static-routes;" >> /etc/dhclient.conf
-EOF
-cat >etc/rc.local <<EOF
-(
- set -x
- echo "starting buildlet script"
- netstat -rn
- cat /etc/resolv.conf
- dig metadata.google.internal
- (
- set -e
- export PATH="\$PATH:/usr/local/bin"
- /usr/local/bin/curl -o /buildlet \$(/usr/local/bin/curl -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/attributes/buildlet-binary-url)
- chmod +x /buildlet
- exec /buildlet
- )
- echo "giving up"
- sleep 10
- halt -p
-)
-EOF
-chmod +x install.site
-tar -zcvf site56.tgz install.site etc/rc.local
-
-# Hack install CD a bit.
-echo 'set tty com0' > boot.conf
-dd if=/dev/urandom of=random.seed bs=4096 count=1
-cp install56.iso install56-patched.iso
-growisofs -M install56-patched.iso -l -R -graft-points \
- /5.6/i386/site56.tgz=site56.tgz \
- /etc/boot.conf=boot.conf \
- /etc/random.seed=random.seed
-
-# Initialize disk image.
-rm -f disk.raw
-qemu-img create -f raw disk.raw 10G
-
-# Run the installer to create the disk image.
-expect <<EOF
-spawn qemu-system-x86_64 -nographic -smp 2 -drive if=virtio,file=disk.raw -cdrom install56-patched.iso -net nic,model=virtio -net user -boot once=d
-
-expect "boot>"
-send "\n"
-
-# Need to wait for the kernel to boot.
-expect -timeout 600 "\(I\)nstall, \(U\)pgrade, \(A\)utoinstall or \(S\)hell\?"
-send "i\n"
-
-expect "Terminal type\?"
-send "vt220\n"
-
-expect "System hostname\?"
-send "buildlet\n"
-
-expect "Which network interface do you wish to configure\?"
-send "vio0\n"
-
-expect "IPv4 address for vio0\?"
-send "dhcp\n"
-
-expect "IPv6 address for vio0\?"
-send "none\n"
-
-expect "Which network interface do you wish to configure\?"
-send "done\n"
-
-expect "Password for root account\?"
-send "root\n"
-
-expect "Password for root account\?"
-send "root\n"
-
-expect "Start sshd\(8\) by default\?"
-send "yes\n"
-
-expect "Start ntpd\(8\) by default\?"
-send "no\n"
-
-expect "Do you expect to run the X Window System\?"
-send "no\n"
-
-expect "Do you want the X Window System to be started by xdm\(1\)\?"
-send "no\n"
-
-expect "Do you want to suspend on lid close\?"
-send "no\n"
-
-expect "Change the default console to com0\?"
-send "yes\n"
-
-expect "Which speed should com0 use\?"
-send "115200\n"
-
-expect "Setup a user\?"
-send "gopher\n"
-
-expect "Full name for user gopher\?"
-send "Gopher Gopherson\n"
-
-expect "Password for user gopher\?"
-send "gopher\n"
-
-expect "Password for user gopher\?"
-send "gopher\n"
-
-expect "Since you set up a user, disable sshd\(8\) logins to root\?"
-send "yes\n"
-
-expect "What timezone are you in\?"
-send "US/Pacific\n"
-
-expect "Which disk is the root disk\?"
-send "sd0\n"
-
-expect "Use DUIDs rather than device names in fstab\?"
-send "yes\n"
-
-expect "Use \(W\)hole disk or \(E\)dit the MBR\?"
-send "whole\n"
-
-expect "Use \(A\)uto layout, \(E\)dit auto layout, or create \(C\)ustom layout\?"
-send "custom\n"
-
-expect "> "
-send "z\n"
-
-expect "> "
-send "a b\n"
-expect "offset: "
-send "\n"
-expect "size: "
-send "1G\n"
-expect "FS type: "
-send "swap\n"
-
-expect "> "
-send "a a\n"
-expect "offset: "
-send "\n"
-expect "size: "
-send "\n"
-expect "FS type: "
-send "4.2BSD\n"
-expect "mount point: "
-send "/\n"
-
-expect "> "
-send "w\n"
-expect "> "
-send "q\n"
-
-expect "Location of sets\?"
-send "cd\n"
-
-expect "Which CD-ROM contains the install media\?"
-send "cd0\n"
-
-expect "Pathname to the sets\?"
-send "5.6/i386\n"
-
-expect "Set name\(s\)\?"
-send "+*\n"
-
-expect "Set name\(s\)\?"
-send " -x*\n"
-
-expect "Set name\(s\)\?"
-send " -game*\n"
-
-expect "Set name\(s\)\?"
-send " -man*\n"
-
-expect "Set name\(s\)\?"
-send "done\n"
-
-expect "Directory does not contain SHA256\.sig\. Continue without verification\?"
-send "yes\n"
-
-# Need to wait for previous sets to unpack.
-expect -timeout 600 "Location of sets\?"
-send "done\n"
-
-expect "Ambiguous: choose dependency for git"
-send "0\n"
-
-# Need to wait for install.site to install curl, git, et
-expect -timeout 600 "CONGRATULATIONS!"
-
-expect "# "
-send "halt\n"
-
-expect "Please press any key to reboot.\n"
-send "\n"
-
-expect "boot>"
-send "\n"
-
-expect -timeout 600 eof
-EOF
-
-# Create Compute Engine disk image.
-echo "Archiving disk.raw... (this may take a while)"
-tar -Szcf openbsd-386-gce.tar.gz disk.raw
-
-echo "Done. GCE image is openbsd-386-gce.tar.gz."
+ARCH=i386 ../openbsd-amd64/make.bash
diff --git a/env/openbsd-amd64/.gitignore b/env/openbsd-amd64/.gitignore
index f1bb5ed..f8f5d41 100644
--- a/env/openbsd-amd64/.gitignore
+++ b/env/openbsd-amd64/.gitignore
@@ -1,8 +1,10 @@
+auto_install.conf
boot.conf
disk.raw
+disklabel.template
etc
install.site
-install56-patched.iso
-install56.iso
+install*.iso
+openbsd-*-gce.tar.gz
random.seed
-site56.tgz
+site58.tgz
diff --git a/env/openbsd-amd64/make.bash b/env/openbsd-amd64/make.bash
index 9ed91cd..2ac3793 100755
--- a/env/openbsd-amd64/make.bash
+++ b/env/openbsd-amd64/make.bash
@@ -3,25 +3,54 @@
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-set -e
+# This script requires expect, growisofs and qemu.
-# Download kernel, sets, etc. from ftp.usa.openbsd.org
-if ! [ -e install56.iso ]; then
- curl -O ftp://ftp.usa.openbsd.org/pub/OpenBSD/5.6/amd64/install56.iso
+set -e
+set -u
+
+readonly ARCH="${ARCH:-amd64}"
+readonly MIRROR="${MIRROR:-ftp.usa.openbsd.org}"
+
+if [[ "${ARCH}" != "amd64" && "${ARCH}" != "i386" ]]; then
+ echo "ARCH must be amd64 or i386"
+ exit 1
fi
+readonly ISO="install58-${ARCH}.iso"
+readonly ISO_PATCHED="install58-${ARCH}-patched.iso"
+
+if [[ ! -f "${ISO}" ]]; then
+ curl -o "${ISO}" "http://${MIRROR}/pub/OpenBSD/5.8/${ARCH}/install58.iso"
+fi
+
+function cleanup() {
+ rm -f "${ISO_PATCHED}"
+ rm -f auto_install.conf
+ rm -f boot.conf
+ rm -f disk.raw
+ rm -f disklabel.template
+ rm -f etc/rc.local
+ rm -f install.site
+ rm -f random.seed
+ rm -f site58.tgz
+ rmdir etc
+}
+
+trap cleanup EXIT INT
+
# XXX: Download and save bash, curl, and their dependencies too?
# Currently we download them from the network during the install process.
-# Create custom site56.tgz set.
+# Create custom site58.tgz set.
mkdir -p etc
cat >install.site <<EOF
#!/bin/sh
-env PKG_PATH=ftp://ftp.usa.openbsd.org/pub/OpenBSD/5.6/packages/amd64 pkg_add -iv bash curl git
+env PKG_PATH=http://${MIRROR}/pub/OpenBSD/5.8/packages/${ARCH} \
+ pkg_add -iv bash curl git
-# See https://code.google.com/p/google-compute-engine/issues/detail?id=77
-echo "ignore classless-static-routes;" >> /etc/dhclient.conf
+echo 'set tty com0' > boot.conf
EOF
+
cat >etc/rc.local <<EOF
(
set -x
@@ -42,14 +71,46 @@
)
EOF
chmod +x install.site
-tar -zcvf site56.tgz install.site etc/rc.local
+tar -zcvf site58.tgz install.site etc/rc.local
+
+# Autoinstall script.
+cat >auto_install.conf <<EOF
+System hostname = buildlet
+Which network interface = vio0
+IPv4 address for vio0 = dhcp
+IPv6 address for vio0 = none
+DNS nameservers = 8.8.8.8
+Password for root account = root
+Do you expect to run the X Window System = no
+Change the default console to com0 = yes
+Which speed should com0 use = 115200
+Setup a user = gopher
+Full name for user gopher = Gopher Gopherson
+Password for user gopher = gopher
+Allow root ssh login = no
+What timezone = US/Pacific
+Which disk = sd0
+Use (W)hole disk or (E)dit the MBR = whole
+Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout = auto
+URL to autopartitioning template for disklabel = file://disklabel.template
+Set name(s) = +* -x* -game* -man* done
+Directory does not contain SHA256.sig. Continue without verification = yes
+EOF
+
+# Disklabel template.
+cat >disklabel.template <<EOF
+/ 5G-* 95%
+swap 1G
+EOF
# Hack install CD a bit.
echo 'set tty com0' > boot.conf
dd if=/dev/urandom of=random.seed bs=4096 count=1
-cp install56.iso install56-patched.iso
-growisofs -M install56-patched.iso -l -R -graft-points \
- /5.6/amd64/site56.tgz=site56.tgz \
+cp "${ISO}" "${ISO_PATCHED}"
+growisofs -M "${ISO_PATCHED}" -l -R -graft-points \
+ /5.8/${ARCH}/site58.tgz=site58.tgz \
+ /auto_install.conf=auto_install.conf \
+ /disklabel.template=disklabel.template \
/etc/boot.conf=boot.conf \
/etc/random.seed=random.seed
@@ -59,169 +120,29 @@
# Run the installer to create the disk image.
expect <<EOF
-spawn qemu-system-x86_64 -nographic -smp 2 -drive if=virtio,file=disk.raw -cdrom install56-patched.iso -net nic,model=virtio -net user -boot once=d
+spawn qemu-system-x86_64 -nographic -smp 2 -drive if=virtio,file=disk.raw \
+ -cdrom "${ISO_PATCHED}" -net nic,model=virtio -net user -boot once=d
expect "boot>"
send "\n"
# Need to wait for the kernel to boot.
expect -timeout 600 "\(I\)nstall, \(U\)pgrade, \(A\)utoinstall or \(S\)hell\?"
-send "i\n"
-
-expect "Terminal type\?"
-send "vt220\n"
-
-expect "System hostname\?"
-send "buildlet\n"
-
-expect "Which network interface do you wish to configure\?"
-send "vio0\n"
-
-expect "IPv4 address for vio0\?"
-send "dhcp\n"
-
-expect "IPv6 address for vio0\?"
-send "none\n"
-
-expect "Which network interface do you wish to configure\?"
-send "done\n"
-
-expect "Password for root account\?"
-send "root\n"
-
-expect "Password for root account\?"
-send "root\n"
-
-expect "Start sshd\(8\) by default\?"
-send "yes\n"
-
-expect "Start ntpd\(8\) by default\?"
-send "no\n"
-
-expect "Do you expect to run the X Window System\?"
-send "no\n"
-
-expect "Do you want the X Window System to be started by xdm\(1\)\?"
-send "no\n"
-
-expect "Do you want to suspend on lid close\?"
-send "no\n"
-
-expect "Change the default console to com0\?"
-send "yes\n"
-
-expect "Which speed should com0 use\?"
-send "115200\n"
-
-expect "Setup a user\?"
-send "gopher\n"
-
-expect "Full name for user gopher\?"
-send "Gopher Gopherson\n"
-
-expect "Password for user gopher\?"
-send "gopher\n"
-
-expect "Password for user gopher\?"
-send "gopher\n"
-
-expect "Since you set up a user, disable sshd\(8\) logins to root\?"
-send "yes\n"
-
-expect "What timezone are you in\?"
-send "US/Pacific\n"
-
-expect "Which disk is the root disk\?"
-send "sd0\n"
-
-expect "Use DUIDs rather than device names in fstab\?"
-send "yes\n"
-
-expect "Use \(W\)hole disk or \(E\)dit the MBR\?"
-send "whole\n"
-
-expect "Use \(A\)uto layout, \(E\)dit auto layout, or create \(C\)ustom layout\?"
-send "custom\n"
-
-expect "> "
-send "z\n"
-
-expect "> "
-send "a b\n"
-expect "offset: "
-send "\n"
-expect "size: "
-send "1G\n"
-expect "FS type: "
-send "swap\n"
-
-expect "> "
-send "a a\n"
-expect "offset: "
-send "\n"
-expect "size: "
-send "\n"
-expect "FS type: "
-send "4.2BSD\n"
-expect "mount point: "
-send "/\n"
-
-expect "> "
-send "w\n"
-expect "> "
-send "q\n"
-
-expect "Location of sets\?"
-send "cd\n"
-
-expect "Which CD-ROM contains the install media\?"
-send "cd0\n"
-
-expect "Pathname to the sets\?"
-send "5.6/amd64\n"
-
-expect "Set name\(s\)\?"
-send "+*\n"
-
-expect "Set name\(s\)\?"
-send " -x*\n"
-
-expect "Set name\(s\)\?"
-send " -game*\n"
-
-expect "Set name\(s\)\?"
-send " -man*\n"
-
-expect "Set name\(s\)\?"
-send "done\n"
-
-expect "Directory does not contain SHA256\.sig\. Continue without verification\?"
-send "yes\n"
-
-# Need to wait for previous sets to unpack.
-expect -timeout 600 "Location of sets\?"
-send "done\n"
-
-expect "Ambiguous: choose dependency for git"
-send "0\n"
-
-# Need to wait for install.site to install curl, git, et
-expect -timeout 600 "CONGRATULATIONS!"
+send "s\n"
expect "# "
-send "halt\n"
+send "mount /dev/cd0c /mnt\n"
+send "cp /mnt/auto_install.conf /mnt/disklabel.template /\n"
+send "umount /mnt\n"
+send "exit\n"
-expect "Please press any key to reboot.\n"
-send "\n"
-
-expect "boot>"
-send "\n"
+expect -timeout 600 "CONGRATULATIONS!"
expect -timeout 600 eof
EOF
# Create Compute Engine disk image.
echo "Archiving disk.raw... (this may take a while)"
-tar -Szcf openbsd-amd64-gce.tar.gz disk.raw
+tar -Szcf "openbsd-${ARCH}-gce.tar.gz" disk.raw
-echo "Done. GCE image is openbsd-amd64-gce.tar.gz."
+echo "Done. GCE image is openbsd-${ARCH}-gce.tar.gz."