diff --git a/packer_templates/http/freebsd/installerconfig b/packer_templates/http/freebsd/installerconfig index 02045660c..726c8130d 100644 --- a/packer_templates/http/freebsd/installerconfig +++ b/packer_templates/http/freebsd/installerconfig @@ -44,12 +44,22 @@ 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 /usr/home/vagrant -c "Vagrant User" +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 /usr/home/vagrant -chown 1001:1001 /usr/home/vagrant -ln -s /usr/home /home +mkdir -p ${home_base}/vagrant +chown 1001:1001 ${home_base}/vagrant reboot