The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1d6b6ea2d0e617d29681da3cf121abec309d272f

commit 1d6b6ea2d0e617d29681da3cf121abec309d272f
Author:     Mark Johnston <ma...@freebsd.org>
AuthorDate: 2025-09-11 13:05:31 +0000
Commit:     Mark Johnston <ma...@freebsd.org>
CommitDate: 2025-09-11 13:05:31 +0000

    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
---
 release/tools/azure.conf           |  2 --
 release/tools/basic-ci.conf        |  2 --
 release/tools/basic-cloudinit.conf |  2 --
 release/tools/ec2.conf             |  3 ---
 release/tools/gce.conf             |  2 --
 release/tools/openstack.conf       |  1 -
 release/tools/oracle.conf          |  2 --
 release/tools/vmimage.subr         | 11 +++++------
 tests/ci/tools/ci.conf             |  1 -
 9 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/release/tools/azure.conf b/release/tools/azure.conf
index a633e6e508d4..e13b63067fee 100644
--- a/release/tools/azure.conf
+++ b/release/tools/azure.conf
@@ -52,7 +52,5 @@ mlx4en_load="YES"
 mlx5en_load="YES"
 EOF
 
-       touch ${DESTDIR}/firstboot
-
        return 0
 }
diff --git a/release/tools/basic-ci.conf b/release/tools/basic-ci.conf
index 4bcb87aec791..e235c03d39fe 100644
--- a/release/tools/basic-ci.conf
+++ b/release/tools/basic-ci.conf
@@ -30,7 +30,5 @@ PermitEmptyPasswords yes
 UsePAM no
 EOF
 
-       touch_firstboot
-
        return 0
 }
diff --git a/release/tools/basic-cloudinit.conf 
b/release/tools/basic-cloudinit.conf
index 7088c0a5f72a..f8554c42f49c 100644
--- a/release/tools/basic-cloudinit.conf
+++ b/release/tools/basic-cloudinit.conf
@@ -34,7 +34,5 @@ PasswordAuthentication yes
 UsePAM no
 EOF
 
-       touch ${DESTDIR}/firstboot
-
        return 0
 }
diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf
index 31f40962b19d..704a8f3f0073 100644
--- a/release/tools/ec2.conf
+++ b/release/tools/ec2.conf
@@ -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
 }
 
diff --git a/release/tools/gce.conf b/release/tools/gce.conf
index 382a839786f3..dc56be30c7ca 100644
--- a/release/tools/gce.conf
+++ b/release/tools/gce.conf
@@ -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
 }
 
diff --git a/release/tools/openstack.conf b/release/tools/openstack.conf
index 05d2d13bbb39..b73734a4fd04 100644
--- a/release/tools/openstack.conf
+++ b/release/tools/openstack.conf
@@ -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
 }
diff --git a/release/tools/oracle.conf b/release/tools/oracle.conf
index 72c8dd9ded78..688820be9cbe 100644
--- a/release/tools/oracle.conf
+++ b/release/tools/oracle.conf
@@ -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
 }
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index 32eec6f220e7..41f889a1e665 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -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
-}
diff --git a/tests/ci/tools/ci.conf b/tests/ci/tools/ci.conf
index 1d2921ab75f3..2302fc479a47 100644
--- a/tests/ci/tools/ci.conf
+++ b/tests/ci/tools/ci.conf
@@ -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
 }

Reply via email to