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
|
||||
|
||||
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 <<EOF
|
||||
ntpd_enable=YES
|
||||
sshd_enable=YES
|
||||
growfs_enable=YES
|
||||
hostname="freebsd"
|
||||
EOF
|
||||
sysrc -f /mnt/etc/rc.conf ntpd_enable=YES sshd_enable=YES growfs_enable=YES hostname=freebsd
|
||||
|
||||
cp /etc/resolv.conf /mnt/etc/resolv.conf
|
||||
tzsetup -s -C /mnt UTC
|
||||
|
@ -77,13 +73,9 @@ PasswordAuthentication no
|
|||
PermitEmptyPasswords no
|
||||
EOF
|
||||
|
||||
mkdir -p /mnt/usr/local/etc/pkg/repos/
|
||||
cat >/mnt/usr/local/etc/pkg/repos/FreeBSD.conf <<EOF
|
||||
FreeBSD: {
|
||||
url: pkg+http://pkg.FreeBSD.org/\$\{ABI\}/latest
|
||||
enabled: yes
|
||||
}
|
||||
EOF
|
||||
# It doesn't appear to be necessary to use "latest", "quarterly" is new enough
|
||||
#mkdir -p /mnt/usr/local/etc/pkg/repos/
|
||||
#sed -es@quarterly@latest@ </mnt/etc/pkg/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"
|
||||
|
|
Loading…
Reference in a new issue