git: 2c774c1bb4ee - stable/14 - release: Don't reuse disc1/bootonly directories

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 17 Apr 2024 05:43:53 UTC
The branch stable/14 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=2c774c1bb4eeb50285bcbb874d0a139acec98476

commit 2c774c1bb4eeb50285bcbb874d0a139acec98476
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-04-10 03:27:19 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-04-17 05:43:26 +0000

    release: Don't reuse disc1/bootonly directories
    
    The disc1 and bootonly directories have files distributed into them
    for use in "full" and "mini" images; the former are disc1.iso and
    memstick.img, and the latter is bootonly.iso and mini-memstick.img.
    
    Unfortunately the scripts which package a directory tree into an ISO
    or memory stick image also modify the directory, for example to
    create an appropriate /etc/fstab file; so creating two images at the
    same time breaks.
    
    Resolve this by copying disc1 to disc1-disc1 and disc1-memstick,
    and copying bootonly to bootonly-bootonly and bootonly-memstick,
    before using those directories for constructing the ISO+memstick
    images.
    
    MFC after:      1 week
    
    (cherry picked from commit a1bff97300abe4b46528357e39c83da764df1fd8)
---
 release/Makefile | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/release/Makefile b/release/Makefile
index 6c391c9c661d..7b658bb90b29 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -109,7 +109,7 @@ CLEANFILES+=	${I}.xz
 .if defined(WITH_DVD) && !empty(WITH_DVD)
 CLEANFILES+=	pkg-stage
 .endif
-CLEANDIRS=	dist ftp disc1 bootonly dvd
+CLEANDIRS=	dist ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
 beforeclean:
 	chflags -R noschg .
 .include <bsd.obj.mk>
@@ -270,23 +270,31 @@ dvd: packagesystem
 .endif
 	touch ${.TARGET}
 
+disc1-disc1 disc1-memstick: disc1
+	mkdir ${.TARGET}
+	tar -cf- -C disc1 . | tar -xf- -C ${.TARGET}
+
+bootonly-bootonly bootonly-memstick: bootonly
+	mkdir ${.TARGET}
+	tar -cf- -C bootonly . | tar -xf- -C ${.TARGET}
+
 release.iso: disc1.iso
-disc1.iso: disc1
-	cd disc1 && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
+disc1.iso: disc1-disc1
+	cd disc1-disc1 && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
 
 dvd1.iso: dvd pkg-stage
 	cd dvd && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
 
-bootonly.iso: bootonly
-	cd bootonly && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
+bootonly.iso: bootonly-bootonly
+	cd bootonly-bootonly && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
 
 memstick: memstick.img
-memstick.img: disc1
-	cd disc1 && sh ${.CURDIR}/${TARGET}/make-memstick.sh .${NO_ROOT:D/METALOG} ../${.TARGET}
+memstick.img: disc1-memstick
+	cd disc1-memstick && sh ${.CURDIR}/${TARGET}/make-memstick.sh .${NO_ROOT:D/METALOG} ../${.TARGET}
 
 mini-memstick: mini-memstick.img
-mini-memstick.img: bootonly
-	cd bootonly && sh ${.CURDIR}/${TARGET}/make-memstick.sh .${NO_ROOT:D/METALOG} ../${.TARGET}
+mini-memstick.img: bootonly-memstick
+	cd bootonly-memstick && sh ${.CURDIR}/${TARGET}/make-memstick.sh .${NO_ROOT:D/METALOG} ../${.TARGET}
 
 packagesystem: ${DISTRIBUTIONS}
 	sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST