diff options
| author | Greg Steuck <blackgnezdo@gmail.com> | 2020-09-01 10:54:55 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-01 10:54:55 -0700 |
| commit | abf9ba4fc75d9b29af15625d44dcfc1360fad3b7 (patch) | |
| tree | 5002bb7a0b42317e1108b2a2236d1e6e8f596e05 /tools | |
| parent | d5a3ae1f760e7cb2cd5a721d9645ae22eae114fe (diff) | |
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.
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/create-openbsd-gce-ci.sh | 19 | ||||
| -rwxr-xr-x | tools/create-openbsd-vmm-worker.sh | 13 |
2 files changed, 17 insertions, 15 deletions
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 <<EOF #!/bin/sh PKGS="bash gcc%8 git gmake go llvm nano wget" -PKG_PATH=https://${MIRROR}/pub/OpenBSD/${DOWNLOAD_VERSION}/packages/${ARCH}/ pkg_add -I \$PKGS +PKG_PATH=${SNAPSHOTS}packages/${ARCH}/ pkg_add -I \$PKGS PKG_PATH= pkg_info -I \$PKGS && echo pkg_add OK echo 'set tty com0' > boot.conf @@ -84,7 +85,7 @@ cat >etc/sysctl.conf <<EOF hw.smt=1 EOF -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 <<EOF @@ -124,7 +125,7 @@ echo 'set tty com0' > 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 <<EOF diff --git a/tools/create-openbsd-vmm-worker.sh b/tools/create-openbsd-vmm-worker.sh index bd3ccd178..1cc2b2dbc 100755 --- a/tools/create-openbsd-vmm-worker.sh +++ b/tools/create-openbsd-vmm-worker.sh @@ -10,13 +10,14 @@ 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" @@ -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 <<EOF @@ -121,7 +122,7 @@ echo 'set tty com0' > 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 \ |
