1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

release: Create /firstboot in common VM image creation code

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
This commit is contained in:
Mark Johnston
2025-09-11 13:05:31 +00:00
parent 6207325f3a
commit 1d6b6ea2d0
9 changed files with 5 additions and 21 deletions
-2
View File
@@ -52,7 +52,5 @@ mlx4en_load="YES"
mlx5en_load="YES"
EOF
touch ${DESTDIR}/firstboot
return 0
}
-2
View File
@@ -30,7 +30,5 @@ PermitEmptyPasswords yes
UsePAM no
EOF
touch_firstboot
return 0
}
-2
View File
@@ -34,7 +34,5 @@ PasswordAuthentication yes
UsePAM no
EOF
touch ${DESTDIR}/firstboot
return 0
}
-3
View File
@@ -128,9 +128,6 @@ echo "-nfsv4,minorversion=1,oneopenown ${FS}.efs.${REGION}.amazonaws.com:/"
EOF
chmod 755 ${DESTDIR}/etc/autofs/special_efs
# The first time the AMI boots, run "first boot" scripts.
touch ${DESTDIR}/firstboot
return 0
}
-2
View File
@@ -119,8 +119,6 @@ EOF
## of the image prior to packaging for upload to GCE.
#sed -E -i '' 's/^([^#].*[[:space:]])on/\1off/' ${DESTDIR}/etc/ttys
touch ${DESTDIR}/firstboot
return 0
}
-1
View File
@@ -47,6 +47,5 @@ vm_extra_pre_umount() {
echo 'debug.debugger_on_panic=0' >> ${DESTDIR}/etc/sysctl.conf
echo 'kern.panic_reboot_wait_time=0' >> ${DESTDIR}/etc/sysctl.conf
touch ${DESTDIR}/firstboot
return 0
}
-2
View File
@@ -87,7 +87,5 @@ EOF
sed -i '' -E -e 's/^pool.*iburst/server 169.254.169.254 iburst/' \
${DESTDIR}/etc/ntp.conf
touch ${DESTDIR}/firstboot
return 0
}
+5 -6
View File
@@ -157,7 +157,6 @@ vm_extra_enable_services() {
${DESTDIR}/etc/rc.conf
# Expand the filesystem to fill the disk.
echo 'growfs_enable="YES"' >> ${DESTDIR}/etc/rc.conf
touch ${DESTDIR}/firstboot
fi
return 0
@@ -351,6 +350,11 @@ vm_create_disk() {
>> ${DESTDIR}/etc/fstab
fi
# Add a marker file which indicates that this image has never
# been booted. Some services run only upon the first boot.
touch ${DESTDIR}/firstboot
metalog_add_data ./firstboot
echo "Building filesystem... Please wait."
buildfs
@@ -375,8 +379,3 @@ vm_extra_create_disk() {
return 0
}
touch_firstboot() {
touch ${DESTDIR}/firstboot
metalog_add_data ./firstboot
}
-1
View File
@@ -119,7 +119,6 @@ fdesc /dev/fd fdescfs rw 0 0
EOF
mkdir -p ${DESTDIR}/usr/local/etc/rc.d
cp -p ${scriptdir}/../../tests/ci/tools/freebsdci ${DESTDIR}/usr/local/etc/rc.d/
touch ${DESTDIR}/firstboot
return 0
}