git: a1bff97300ab - main - release: Don't reuse disc1/bootonly directories

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Wed, 10 Apr 2024 03:29:22 UTC
The branch main has been updated by cperciva:

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

commit a1bff97300abe4b46528357e39c83da764df1fd8
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-04-10 03:27:19 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-04-10 03:29:16 +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
---
 release/Makefile | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/release/Makefile b/release/Makefile
index 26f39e8f8acb..99927d611257 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>
@@ -267,23 +267,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