From 33cc65ecc266068aa1e8f92d8db25e18c9f612a8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 12 Jun 2022 08:37:24 +0200 Subject: [PATCH] Upgrade to FreeBSD 13 and sync with ZFS script --- .../freebsd-build-opennebula-image.sh | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/opennebula-images/freebsd-build-opennebula-image.sh b/opennebula-images/freebsd-build-opennebula-image.sh index c76f9fc..af5e6a8 100755 --- a/opennebula-images/freebsd-build-opennebula-image.sh +++ b/opennebula-images/freebsd-build-opennebula-image.sh @@ -13,9 +13,8 @@ IMAGE_PATH=freebsd-$RELEASE-$(date -I).img.qcow2 IMAGE_SIZE=10G DIST_BASE="https://download.freebsd.org/ftp/releases/$ARCH/$RELEASE" -PORTS_BASE="https://download.freebsd.org/ftp/snapshots/$ARCH/13.0-STABLE" -ONE_CONTEXT_PKG_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v5.12.0/one-context-5.12.0_1.txz" +ONE_CONTEXT_PKG_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v6.2.0/one-context-6.2.0_1.txz" cleanup() { sync || true @@ -30,6 +29,8 @@ if [ "$(whoami)" != 'root' ]; then exit 1 fi +env ASSUME_ALWAYS_YES=YES pkg install -y qemu-tools + # Allocate and partition/format disk image. disk=$(mktemp) truncate -s 6G $disk @@ -59,14 +60,9 @@ done # Configure new system. echo "/dev/gpt/rootfs / ufs rw,noatime 1 1" >/mnt/etc/fstab touch /mnt/firstboot -echo 'autoboot_delay="-1"' >>/mnt/boot/loader.conf +sysrc -f /mnt/boot/loader.conf autoboot_delay=-1 -cat >>/mnt/etc/rc.conf </mnt/usr/local/etc/pkg/repos/FreeBSD.conf </mnt/usr/local/etc/pkg/repos/FreeBSD.conf # freebsd-update is only supported for RELEASE if [ "${release%-RELEASE}" != "$RELEASE" ] @@ -93,20 +85,22 @@ then --currently-running "$RELEASE" \ --not-running-from-cron -F \ fetch install + rm -rf /mnt/var/db/freebsd-update/* fi env ASSUME_ALWAYS_YES=YES pkg -c /mnt bootstrap -f -env ASSUME_ALWAYS_YES=YES pkg -c /mnt install bash curl -curl -L "$ONE_CONTEXT_PKG_URL" -o /mnt/one-context.txz -env ASSUME_ALWAYS_YES=YES pkg -c /mnt add one-context.txz +fetch -m -o /mnt/one-context.txz "$ONE_CONTEXT_PKG_URL" +# OpenNebula has dependencies, but these are not included in the package for some reason +# https://github.com/OpenNebula/addon-context-linux/blob/40efc929487b2955e6f32643853a5cdc93c548da/targets.sh#L25 +# It would be useful to see if there is an alternative to OpenNebula without so many dependencies, +# so we can run on FreeBSD base, and avoid breaking OpenNebula when the admin removes a dependency. +env ASSUME_ALWAYS_YES=YES pkg -c /mnt install sudo bash curl base64 ruby open-vm-tools-nox11 gawk virt-what one-context.txz +env ASSUME_ALWAYS_YES=YES pkg -c /mnt clean --all rm /mnt/one-context.txz -fetch -m -o "$dist_dir/ports.txz" "$PORTS_BASE/ports.txz" -tar -C /mnt -xJf "$dist_dir/ports.txz" - -cleanup trap : EXIT +cleanup mkdir -p "$ARCH" qemu-img convert -f raw -O qcow2 "$disk" "$IMAGE_PATH"