From abf9ba4fc75d9b29af15625d44dcfc1360fad3b7 Mon Sep 17 00:00:00 2001 From: Greg Steuck Date: Tue, 1 Sep 2020 10:54:55 -0700 Subject: tools/create-openbsd: auto-detect snapshot version (#2082) Removed some never-used knobs as syzkaller always uses snapshots. Resolved some ShellCheck'd lint. TESTED=by installing Aug31 6.8 beta. --- tools/create-openbsd-gce-ci.sh | 19 ++++++++++--------- tools/create-openbsd-vmm-worker.sh | 13 +++++++------ 2 files changed, 17 insertions(+), 15 deletions(-) (limited to 'tools') diff --git a/tools/create-openbsd-gce-ci.sh b/tools/create-openbsd-gce-ci.sh index 1d831c797..60eb5ae00 100755 --- a/tools/create-openbsd-gce-ci.sh +++ b/tools/create-openbsd-gce-ci.sh @@ -10,18 +10,19 @@ set -eu -o pipefail readonly MIRROR="${MIRROR:-cdn.openbsd.org}" -readonly VERSION="${VERSION:-6.7}" -readonly DOWNLOAD_VERSION="${DOWNLOAD_VERSION:-snapshots}" -readonly RELNO="${2:-${VERSION/./}}" - # The only supported setting. readonly ARCH="amd64" +readonly SNAPSHOTS="https://${MIRROR}/pub/OpenBSD/snapshots/" +readonly VERSION=$(curl -s "${SNAPSHOTS}${ARCH}/" | perl -ne 'print "$1.$2" if m/>base(.)(.)\.tgz/') +echo "Found snapshots for version ${VERSION}" + +readonly RELNO="${2:-${VERSION/./}}" readonly ISO="install${RELNO}-${ARCH}.iso" readonly ISO_PATCHED="install${RELNO}-${ARCH}-patched.iso" if [[ ! -f "${ISO}" ]]; then - curl -o "${ISO}" "https://${MIRROR}/pub/OpenBSD/${DOWNLOAD_VERSION}/${ARCH}/install${RELNO}.iso" + curl -o "${ISO}" "${SNAPSHOTS}${ARCH}/install${RELNO}.iso" fi # Create custom siteXX.tgz set. @@ -29,7 +30,7 @@ rm -fr etc && mkdir -p etc cat >install.site < boot.conf @@ -84,7 +85,7 @@ cat >etc/sysctl.conf <auto_install.conf < boot.conf dd if=/dev/urandom of=random.seed bs=4096 count=1 cp "${ISO}" "${ISO_PATCHED}" growisofs -M "${ISO_PATCHED}" -l -R -graft-points \ - /${VERSION}/${ARCH}/site${RELNO}.tgz=site${RELNO}.tgz \ + "/${VERSION}/${ARCH}/site${RELNO}.tgz=site${RELNO}.tgz" \ /auto_install.conf=auto_install.conf \ /disklabel.template=disklabel.template \ /etc/boot.conf=boot.conf \ @@ -192,7 +193,7 @@ grep 'pkg_add OK' install_log > /dev/null \ # Create Compute Engine disk image. echo "Archiving disk.raw... (this may take a while)" -i="openbsd-${ARCH}-${RELNO}-gce.tar.gz" +i="openbsd-${ARCH}-snapshot-gce.tar.gz" tar -Szcf "$i" disk.raw cat <base(.)(.)\.tgz/') +echo "Found snapshots for version ${VERSION}" + +readonly RELNO="${2:-${VERSION/./}}" readonly ISO="install${RELNO}-${ARCH}.iso" readonly ISO_PATCHED="install${RELNO}-${ARCH}-patched.iso" @@ -81,7 +82,7 @@ EOF rm -f worker_key* ssh-keygen -t ed25519 -N '' -f worker_key -C worker_key -tar --owner=root --group=root -zcvf site${RELNO}.tgz install.site etc/* +tar --owner=root --group=root -zcvf "site${RELNO}.tgz" install.site etc/* # Autoinstall script. cat >auto_install.conf < boot.conf dd if=/dev/urandom of=random.seed bs=4096 count=1 cp "${ISO}" "${ISO_PATCHED}" growisofs -M "${ISO_PATCHED}" -l -R -graft-points \ - /${VERSION}/${ARCH}/site${RELNO}.tgz=site${RELNO}.tgz \ + "/${VERSION}/${ARCH}/site${RELNO}.tgz=site${RELNO}.tgz" \ /auto_install.conf=auto_install.conf \ /disklabel.template=disklabel.template \ /etc/boot.conf=boot.conf \ -- cgit mrf-deployment