Module Name:    src
Committed By:   christos
Date:           Fri May 17 19:54:28 UTC 2024

Modified Files:
        src/distrib/common: Makefile.image

Log Message:
Add IMAGERUNTIME and IMAGESPECEXTRA variables


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/distrib/common/Makefile.image

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/common/Makefile.image
diff -u src/distrib/common/Makefile.image:1.42 src/distrib/common/Makefile.image:1.43
--- src/distrib/common/Makefile.image:1.42	Thu May 16 11:46:42 2024
+++ src/distrib/common/Makefile.image	Fri May 17 15:54:28 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.image,v 1.42 2024/05/16 15:46:42 christos Exp $
+#	$NetBSD: Makefile.image,v 1.43 2024/05/17 19:54:28 christos Exp $
 #
 # Makefile snippet to build a tree from the provided lists,
 # and make an ffs file system image from that tree
@@ -16,6 +16,8 @@
 #	IMAGEPREBUILD	additional operations to run pre image creation
 #	IMAGEPOSTBUILD	operation to run on ${IMAGE} ${.TARGET} after its built
 #			(if this returns non zero, ${.TARGET} is removed)
+#	IMAGERUNTIME	files/directories to copy from $DESTDIR onto the image
+#	IMAGESPECEXTRA	files/directories to add to the spec
 #	CRUNCHBIN	name of crunchgen(1)ed binary
 #	DESTDIR		destination directory
 #	MAKEFS_FLAGS	extra options to ${TOOL_MAKEFS}
@@ -34,6 +36,7 @@ _MAKEFILE_IMAGE_=1
 WORKDIR?=	work
 WORKSPEC?=	work.spec
 WORKBUILT?=	work.built
+CUROBJDIR!=     cd ${.CURDIR} && ${PRINTOBJDIR}
 
 .include "${DISTRIBDIR}/common/Makefile.parselist"
 
@@ -44,6 +47,14 @@ MAKEFS_TIMESTAMP=-T "${MKREPRO_TIMESTAMP
 PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
 GZIP_N_FLAG=-n
 .endif
+MAKESPEC=	${HOST_SH} ${NETBSDSRCDIR}/etc/makespec
+
+.if ${MAKEVERBOSE} >= 2 
+PAX_v?= -v
+.else   
+PAX_v?= 
+.endif  
+
 
 GZIP_FLAGS= -9 ${GZIP_N_FLAG}
 
@@ -95,6 +106,22 @@ ${IMAGE}: ${WORKBUILT}
 .if defined(IMAGEPREBUILD)
 	${IMAGEPREBUILD}
 .endif
+	if [ "X${IMAGERUNTIME}" != "X" ]; then				\
+		release_destdir=${WORKDIR};				\
+		cd $$release_destdir;					\
+		cd ${DESTDIR};						\
+		for imge in ${IMAGERUNTIME};				\
+		do							\
+			${TOOL_PAX} ${PAX_TIMESTAMP} -rw -pp ${PAX_v}	\
+				$${imge} $$release_destdir;		\
+		done;							\
+		cd "${CUROBJDIR}";					\
+	fi
+	for i in ${IMAGERUNTIME} ${IMAGESPECEXTRA}; do 			\
+		if [ -n "$$i" ] && [ -e ${WORKDIR}/$$i ]; then 		\
+		    ${MAKESPEC} -d ${WORKDIR} $$i >> ${WORKSPEC}; 	\
+		fi; 							\
+	done
 	[ "${.OODATE}" = ${WORKBUILT} -a -f ${IMAGE} -a ! ${IMAGE} -ot ${WORKBUILT} ]  || { \
 	${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}; \
 	rm -f ${.TARGET} ${.TARGET}.tmp; \

Reply via email to