Skip to content

Instantly share code, notes, and snippets.

@backerman
Created October 16, 2022 04:18
Show Gist options
  • Save backerman/f6fcba337d8c074009606c6b4257b22d to your computer and use it in GitHub Desktop.
Save backerman/f6fcba337d8c074009606c6b4257b22d to your computer and use it in GitHub Desktop.
bsdinstall script file for zfs root image
# Install FreeBSD into a data disk on Azure.
# The ZFS-specific variables must be exported.
export ZFSBOOT_VDEV_TYPE=stripe
export ZFSBOOT_DISKS=@@DISK@@
export ZFSBOOT_POOL_NAME=zroot
export ZFSBOOT_SWAP_SIZE=0
export nonInteractive="YES"
DISTRIBUTIONS="base.txz kernel.txz src.txz"
#!/bin/sh -e
# Install all OS patches.
env PAGER=cat freebsd-update \
--not-running-from-cron \
--currently-running 13.1-RELEASE \
fetch install
# Configure networking.
sysrc ifconfig_hn0=SYNCDHCP
sysrc sshd_enable=YES
sysrc hostname=localhost.localdomain
# Turn off DNS lookups in sshd.
sed -i '' -e 's/^#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
# Don't spawn all the terminals, since we have no console.
sed -i '' -e '/^ttyv[1-9]/s/^/#/' /etc/ttys
# Speed up boot.
echo >> /etc/sysctl.conf <<EOM
debug.trace_on_panic="1"
debug.debugger_on_panic="0"
kern.panic_reboot_wait_time="0"
EOM
sysrc -f /boot/loader.conf autoboot_delay=-1
# Enable serial console.
sysrc -f /boot/loader.conf console="comconsole" comconsole_speed="115200"
# Java requires fdescfs and procfs.
cat >> /etc/fstab <<EOM
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
EOM
# Enable Linux compatibility. (12.2)
sysrc linux_mounts_enable=YES
# Configure Azure agent.
mkdir -p /usr/local/etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment