DISTRIBUTIONS="base.txz kernel.txz" if [ `uname -m` = "amd64" ]; then DISTRIBUTIONS="${DISTRIBUTIONS} lib32.txz" fi # for variations in the root disk device name between VMware and Virtualbox if [ -e /dev/ada0 ]; then DISKSLICE=ada0 elif [ -e /dev/da0 ]; then DISKSLICE=da0 elif [ -e /dev/vtbd0 ]; then DISKSLICE=vtbd0 else echo "Unknown disk for install.sh to work with!" exit -1 fi # Workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203777 export nonInteractive="YES" export ZFSBOOT_DISKS="$DISKSLICE" export ZFSBOOT_CONFIRM_LAYOUT=0 HOSTNAME=freebsd #!/bin/sh -x ifdev=$(ifconfig | grep '^[a-z]' | cut -d: -f1 | head -n 1) # Enable required services cat >> /etc/rc.conf << EOT clear_tmp_enable="YES" syslogd_flags="-ss" sendmail_enable="NONE" ifconfig_${ifdev}="dhcp" sshd_enable="YES" dumpdev="NO" zfs_enable="YES" EOT # Tune and boot from zfs cat >> /boot/loader.conf << EOT vm.kmem_size="200M" vm.kmem_size_max="200M" vfs.zfs.arc_max="40M" vfs.zfs.vdev.cache.size="5M" autoboot_delay=3 EOT # zfs doesn't use an fstab, but some rc scripts expect one touch /etc/fstab # Since FreeBSD 14.0 bsdinstall again creates dataset for /home rather then /usr/home # Thus on versions prior to 14.0 we have to create /home -> /usr/home symlink, # otherwise just use /home as the base for vagrant's home version=$(freebsd-version -u) if [ "${version%%.*}" -lt "14" ]; then home_base="/usr/home" ln -s $home_base /home else home_base="/home" fi # Set up user accounts echo "vagrant" | pw -V /etc useradd vagrant -h 0 -s /bin/sh -G wheel -d ${home_base}/vagrant -c "Vagrant User" echo "vagrant" | pw -V /etc usermod root mkdir -p ${home_base}/vagrant chown 1001:1001 ${home_base}/vagrant cdcontrol eject reboot