mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-01 05:19:02 +01:00
Some services, such as growfs, only run upon the first boot of an image.
The first boot is indicated by the presence of the file /firstboot,
which is unlinked after boot.
Individual cloudware types shouldn't be responsible for creating it. Do
so in a centralized place. Aside from simplifying things, this ensures
that we create a metalog entry for the firstboot file.
Reviewed by: cperciva, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D52450
(cherry picked from commit 1d6b6ea2d0)
39 lines
989 B
Bash
39 lines
989 B
Bash
#!/bin/sh
|
|
|
|
# Should be enough for base image, image can be resized in needed
|
|
export VMSIZE=5g
|
|
|
|
# 1M config drive should be enough in most cases
|
|
export CONFIG_DRIVE=YES
|
|
export CONFIG_DRIVE_SIZE=1M
|
|
|
|
# Packages to install into the image we're creating.
|
|
# * firstboot-freebsd-update, to install security updates at first boot.
|
|
export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} firstboot-freebsd-update"
|
|
|
|
# Set to a list of third-party software to enable in rc.conf(5).
|
|
export VM_RC_LIST="${VM_RC_LIST} firstboot_freebsd_update growfs sshd nuageinit"
|
|
|
|
vm_extra_pre_umount() {
|
|
cat << EOF >> ${DESTDIR}/etc/rc.conf
|
|
dumpdev="AUTO"
|
|
ifconfig_DEFAULT="SYNCDHCP accept_rtadv"
|
|
# RSA host keys are obsolete and also very slow to generate
|
|
sshd_rsa_enable="NO"
|
|
EOF
|
|
|
|
cat << EOF >> ${DESTDIR}/boot/loader.conf
|
|
autoboot_delay="-1"
|
|
beastie_disable="YES"
|
|
loader_logo="none"
|
|
console="comconsole,vidconsole"
|
|
EOF
|
|
|
|
cat << EOF >> ${DESTDIR}/etc/ssh/sshd_config
|
|
PasswordAuthentication yes
|
|
UsePAM no
|
|
EOF
|
|
|
|
return 0
|
|
}
|