Upgrade to FreeBSD 13 and sync with ZFS script
This commit is contained in:
parent
805ad9228b
commit
33cc65ecc2
1 changed files with 17 additions and 23 deletions
|
@ -13,9 +13,8 @@ IMAGE_PATH=freebsd-$RELEASE-$(date -I).img.qcow2
|
||||||
IMAGE_SIZE=10G
|
IMAGE_SIZE=10G
|
||||||
|
|
||||||
DIST_BASE="https://download.freebsd.org/ftp/releases/$ARCH/$RELEASE"
|
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() {
|
cleanup() {
|
||||||
sync || true
|
sync || true
|
||||||
|
@ -30,6 +29,8 @@ if [ "$(whoami)" != 'root' ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
env ASSUME_ALWAYS_YES=YES pkg install -y qemu-tools
|
||||||
|
|
||||||
# Allocate and partition/format disk image.
|
# Allocate and partition/format disk image.
|
||||||
disk=$(mktemp)
|
disk=$(mktemp)
|
||||||
truncate -s 6G $disk
|
truncate -s 6G $disk
|
||||||
|
@ -59,14 +60,9 @@ done
|
||||||
# Configure new system.
|
# Configure new system.
|
||||||
echo "/dev/gpt/rootfs / ufs rw,noatime 1 1" >/mnt/etc/fstab
|
echo "/dev/gpt/rootfs / ufs rw,noatime 1 1" >/mnt/etc/fstab
|
||||||
touch /mnt/firstboot
|
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 <<EOF
|
sysrc -f /mnt/etc/rc.conf ntpd_enable=YES sshd_enable=YES growfs_enable=YES hostname=freebsd
|
||||||
ntpd_enable=YES
|
|
||||||
sshd_enable=YES
|
|
||||||
growfs_enable=YES
|
|
||||||
hostname="freebsd"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cp /etc/resolv.conf /mnt/etc/resolv.conf
|
cp /etc/resolv.conf /mnt/etc/resolv.conf
|
||||||
tzsetup -s -C /mnt UTC
|
tzsetup -s -C /mnt UTC
|
||||||
|
@ -77,13 +73,9 @@ PasswordAuthentication no
|
||||||
PermitEmptyPasswords no
|
PermitEmptyPasswords no
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p /mnt/usr/local/etc/pkg/repos/
|
# It doesn't appear to be necessary to use "latest", "quarterly" is new enough
|
||||||
cat >/mnt/usr/local/etc/pkg/repos/FreeBSD.conf <<EOF
|
#mkdir -p /mnt/usr/local/etc/pkg/repos/
|
||||||
FreeBSD: {
|
#sed -es@quarterly@latest@ </mnt/etc/pkg/FreeBSD.conf >/mnt/usr/local/etc/pkg/repos/FreeBSD.conf
|
||||||
url: pkg+http://pkg.FreeBSD.org/\$\{ABI\}/latest
|
|
||||||
enabled: yes
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# freebsd-update is only supported for RELEASE
|
# freebsd-update is only supported for RELEASE
|
||||||
if [ "${release%-RELEASE}" != "$RELEASE" ]
|
if [ "${release%-RELEASE}" != "$RELEASE" ]
|
||||||
|
@ -93,20 +85,22 @@ then
|
||||||
--currently-running "$RELEASE" \
|
--currently-running "$RELEASE" \
|
||||||
--not-running-from-cron -F \
|
--not-running-from-cron -F \
|
||||||
fetch install
|
fetch install
|
||||||
|
rm -rf /mnt/var/db/freebsd-update/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
env ASSUME_ALWAYS_YES=YES pkg -c /mnt bootstrap -f
|
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
|
fetch -m -o /mnt/one-context.txz "$ONE_CONTEXT_PKG_URL"
|
||||||
env ASSUME_ALWAYS_YES=YES pkg -c /mnt add one-context.txz
|
# 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
|
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
|
trap : EXIT
|
||||||
|
cleanup
|
||||||
|
|
||||||
mkdir -p "$ARCH"
|
mkdir -p "$ARCH"
|
||||||
qemu-img convert -f raw -O qcow2 "$disk" "$IMAGE_PATH"
|
qemu-img convert -f raw -O qcow2 "$disk" "$IMAGE_PATH"
|
||||||
|
|
Loading…
Reference in a new issue