The branch stable/15 has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=59a0361e5f791c2eb6ea882f9c218e5f49c63861

commit 59a0361e5f791c2eb6ea882f9c218e5f49c63861
Author:     Mark Johnston <[email protected]>
AuthorDate: 2025-09-16 16:53:13 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2025-09-30 09:43:07 +0000

    release: Make azure cloudware images buildable as non-root
    
    - Don't chroot to uninstall pkg since we don't install pkg in the first
      place.
    - Use pw -R instead of chrooting.
    - Add metalog entries.
    
    Reviewed by:    cperciva, emaste
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52451
    
    (cherry picked from commit bab6b01bcfead662b8b10dc52a18beeb42794505)
---
 release/tools/azure.conf | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/release/tools/azure.conf b/release/tools/azure.conf
index a633e6e508d4..dfb90f1cd4f6 100644
--- a/release/tools/azure.conf
+++ b/release/tools/azure.conf
@@ -19,20 +19,25 @@ export NOSWAP=YES
 export VM_BOOTPARTSOFFSET=1M
 
 vm_extra_pre_umount() {
-       mount -t devfs devfs ${DESTDIR}/dev
+       # Remove the pkg package and repo databases as they will likely
+       # be out of date by the time the image is used.  In unprivileged
+       # builds this is unnecessary as pkg will not be installed to
+       # begin with.
+       if [ -z "${NO_ROOT}" ]; then
+               mount -t devfs devfs ${DESTDIR}/dev
 
-       # The firstboot_pkgs rc.d script will download the repository
-       # catalogue and install or update pkg when the instance first
-       # launches, so these files would just be replaced anyway; removing
-       # them from the image allows it to boot faster.
-       chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
-               /usr/sbin/pkg delete -f -y pkg
-       rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports
-       rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods
+               # The firstboot_pkgs rc.d script will download the repository
+               # catalogue and install or update pkg when the instance first
+               # launches, so these files would just be replaced anyway; 
removing
+               # them from the image allows it to boot faster.
+               chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
+                       /usr/sbin/pkg delete -f -y pkg
+               umount ${DESTDIR}/dev
+               rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports
+               rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods
+       fi
 
-       chroot ${DESTDIR} ${EMULATOR} pw usermod root -h -
-
-       umount ${DESTDIR}/dev
+       pw -R ${DESTDIR} usermod root -h -
 
        cat << EOF >> ${DESTDIR}/etc/rc.conf
 ifconfig_hn0="SYNCDHCP"
@@ -51,6 +56,7 @@ boot_serial="YES"
 mlx4en_load="YES"
 mlx5en_load="YES"
 EOF
+       metalog_add_data ./boot/loader.conf
 
        touch ${DESTDIR}/firstboot
 

Reply via email to