xref: /freebsd/release/Makefile (revision 7e2996c1f5b4e684cae40c2418b68061df9997d9)
10202c140SRodney W. Grimes#
212ad0bb1SNathan Whitehorn# Makefile for building releases and release media.
3bd668f6fSPoul-Henning Kamp#
412ad0bb1SNathan Whitehorn# User-driven targets:
58cec99b6SGlen Barber#  cdrom: Builds release CD-ROM media (disc1.iso)
65d27274aSGlen Barber#  dvdrom: Builds release DVD-ROM media (dvd1.iso)
73c334738SGlen Barber#  memstick: Builds memory stick image (memstick.img)
8a9da1707SGlen Barber#  mini-memstick: Builds minimal memory stick image (mini-memstick.img)
912ad0bb1SNathan Whitehorn#  ftp: Sets up FTP distribution area (ftp)
10d03c82c2SDoug Rabson#  release: Invokes real-release, vm-release, cloudware-release and oci-release targets
114afe7cf5SGlen Barber#  real-release: Build all media and FTP distribution area
124afe7cf5SGlen Barber#  vm-release: Build all virtual machine image targets
134afe7cf5SGlen Barber#  cloudware-release: Build all cloud hosting provider targets
14d03c82c2SDoug Rabson#  oci-release: Build all OCI container images
15d03c82c2SDoug Rabson#  install: Invokes the release-install, vm-install and oci-install targets
162d4ff62fSGlen Barber#  release-install: Copies all release installation media into ${DESTDIR}
172d4ff62fSGlen Barber#  vm-install: Copies all virtual machine images into ${DESTDIR}
184771c2e9SColin Percival#  cloud-install: Copies non-uploaded cloud images into ${DESTDIR}
19d03c82c2SDoug Rabson#  oci-install: Copies all OCI container images into ${DESTDIR}
20bd668f6fSPoul-Henning Kamp#
2112ad0bb1SNathan Whitehorn# Variables affecting the build process:
2212ad0bb1SNathan Whitehorn#  WORLDDIR: location of src tree -- must have built world and default kernel
2312ad0bb1SNathan Whitehorn#            (by default, the directory above this one)
2412ad0bb1SNathan Whitehorn#  PORTSDIR: location of ports tree to distribute (default: /usr/ports)
251b8a3e1dSDevin Teske#  XTRADIR:  xtra-bits-dir argument for <arch>/mkisoimages.sh
269d22cb2eSHiroki Sato#  NOPKG:    if set, do not distribute third-party packages
2712ad0bb1SNathan Whitehorn#  NOPORTS:  if set, do not distribute ports tree
2812ad0bb1SNathan Whitehorn#  NOSRC:    if set, do not distribute source tree
29f7f650c7SGlen Barber#  WITH_DVD: if set, generate dvd1.iso
3055af5cf1SGlen Barber#  WITH_COMPRESSED_IMAGES: if set, compress installation images with xz(1)
31cbc0e08aSGlen Barber#		(uncompressed images are not removed)
32a68d274bSGlen Barber#  WITH_VMIMAGES: if set, build virtual machine images with the release
33a9278c16SGlen Barber#  WITH_COMPRESSED_VMIMAGES: if set, compress virtual machine disk images
34a9278c16SGlen Barber#  		with xz(1) (extremely time consuming)
352d4ff62fSGlen Barber#  WITH_CLOUDWARE: if set, build cloud hosting disk images with the release
3612ad0bb1SNathan Whitehorn#  TARGET/TARGET_ARCH: architecture of built release
37b03ddec9SJohn Baldwin#
38ab0e9cdcSPoul-Henning Kamp
3912ad0bb1SNathan WhitehornWORLDDIR?=	${.CURDIR}/..
4012ad0bb1SNathan WhitehornPORTSDIR?=	/usr/ports
41fff8eb57SJohn Baldwin
426853d893SJessica Clarke.include "${WORLDDIR}/share/mk/bsd.compat.pre.mk"
436853d893SJessica Clarke
44464485c8SHiroki Sato.if !defined(TARGET) || empty(TARGET)
45464485c8SHiroki SatoTARGET=		${MACHINE}
46464485c8SHiroki Sato.endif
47464485c8SHiroki Sato.if !defined(TARGET_ARCH) || empty(TARGET_ARCH)
480bd47e83SNathan Whitehorn.if ${TARGET} == ${MACHINE}
49464485c8SHiroki SatoTARGET_ARCH=	${MACHINE_ARCH}
508f1f55e9SRuslan Ermilov.else
51464485c8SHiroki SatoTARGET_ARCH=	${TARGET}
52464485c8SHiroki Sato.endif
538f1f55e9SRuslan Ermilov.endif
5412ad0bb1SNathan WhitehornIMAKE=		${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
55876acefaSHiroki SatoDISTDIR=	dist
568f1f55e9SRuslan Ermilov
5708f1325dSGlen Barber# Define OSRELEASE by using newvers.sh
58de17cbccSHiroki Sato.if !defined(OSRELEASE) || empty(OSRELEASE)
59de17cbccSHiroki Sato.for _V in TYPE BRANCH REVISION
60de17cbccSHiroki Sato${_V}!=	eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}
61de17cbccSHiroki Sato.endfor
62de17cbccSHiroki Sato.for _V in ${TARGET_ARCH}
63de17cbccSHiroki Sato.if !empty(TARGET:M${_V})
64de17cbccSHiroki SatoOSRELEASE=	${TYPE}-${REVISION}-${BRANCH}-${TARGET}
65745ca085SGlen BarberVOLUME_LABEL=	${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET}
66de17cbccSHiroki Sato.else
67de17cbccSHiroki SatoOSRELEASE=	${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
68745ca085SGlen BarberVOLUME_LABEL=	${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET_ARCH}
69de17cbccSHiroki Sato.endif
70de17cbccSHiroki Sato.endfor
71de17cbccSHiroki Sato.endif
72de17cbccSHiroki Sato
73*7e2996c1SBjoern A. Zeeb.if ${.MAKE.OS} == "FreeBSD"
74*7e2996c1SBjoern A. Zeeb# For installing packages into the release media.
75*7e2996c1SBjoern A. Zeeb.if defined(NO_ROOT)
76*7e2996c1SBjoern A. ZeebPKG_ENV+=	INSTALL_AS_USER=yes
77*7e2996c1SBjoern A. ZeebPKG_ARGS+=	-o METALOG=METALOG
78*7e2996c1SBjoern A. Zeeb.endif
79*7e2996c1SBjoern A. ZeebPKG_ENV+=	ASSUME_ALWAYS_YES=yes
80*7e2996c1SBjoern A. ZeebPKG_ARGS+=	-r ${.TARGET} -o REPOS_DIR=${.CURDIR}/pkg_repos
81*7e2996c1SBjoern A. ZeebPKG_INSTALL=	env ${PKG_ENV} ${PKG_CMD} ${PKG_ARGS} install
82*7e2996c1SBjoern A. Zeeb.endif
83*7e2996c1SBjoern A. Zeeb
8469c7d069SGlen Barber.if !defined(VOLUME_LABEL) || empty(VOLUME_LABEL)
8569c7d069SGlen BarberVOLUME_LABEL=	FreeBSD_Install
8669c7d069SGlen Barber.endif
87ac23f460SGlen Barber
8812ad0bb1SNathan Whitehorn.if !exists(${PORTSDIR})
8912ad0bb1SNathan WhitehornNOPORTS= true
90dd1a1b3dSJoerg Wunsch.endif
91dd1a1b3dSJoerg Wunsch
922e9b8c8cSEd MasteDISTRIBUTIONS= base.txz kernel.txz
936daa108fSRuslan Ermilov.if !defined(NOPORTS)
942e9b8c8cSEd MasteDISTRIBUTIONS+= ports.txz
956daa108fSRuslan Ermilov.endif
964731faa3SJordan K. Hubbard.if !defined(NOSRC)
972e9b8c8cSEd MasteDISTRIBUTIONS+= src.txz
982e3a1557SKen Smith.endif
99b2200964SJohn Baldwin
10012ad0bb1SNathan WhitehornRELEASE_TARGETS= ftp
101876acefaSHiroki SatoIMAGES=
10212ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/mkisoimages.sh)
10312ad0bb1SNathan WhitehornRELEASE_TARGETS+= cdrom
1048cec99b6SGlen BarberIMAGES+=	disc1.iso bootonly.iso
105d8824524SGlen Barber. if defined(WITH_DVD) && !empty(WITH_DVD)
106dc244562SGlen BarberRELEASE_TARGETS+= dvdrom
107dc244562SGlen BarberIMAGES+=	dvd1.iso
108dc244562SGlen Barber. endif
1096daa108fSRuslan Ermilov.endif
11012ad0bb1SNathan Whitehorn.if exists(${.CURDIR}/${TARGET}/make-memstick.sh)
1113c334738SGlen BarberRELEASE_TARGETS+= memstick.img
112a9da1707SGlen BarberRELEASE_TARGETS+= mini-memstick.img
1133c334738SGlen BarberIMAGES+=	memstick.img
114a9da1707SGlen BarberIMAGES+=	mini-memstick.img
115e738d1eaSJohn Baldwin.endif
116e738d1eaSJohn Baldwin
117a55e34ebSGlen BarberCLEANFILES=	packagesystem *.txz MANIFEST release ${IMAGES}
1180c535991SGlen Barber.if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES)
1190c535991SGlen Barber. for I in ${IMAGES}
12055af5cf1SGlen BarberCLEANFILES+=	${I}.xz
1210c535991SGlen Barber. endfor
1220c535991SGlen Barber.endif
123cd15d7f3SGlen Barber.if defined(WITH_DVD) && !empty(WITH_DVD)
124cd15d7f3SGlen BarberCLEANFILES+=	pkg-stage
125cd15d7f3SGlen Barber.endif
126a1bff973SColin PercivalCLEANDIRS=	dist ftp disc1 disc1-disc1 disc1-memstick bootonly bootonly-bootonly bootonly-memstick dvd
12746b13263SHiroki Satobeforeclean:
12846b13263SHiroki Sato	chflags -R noschg .
1298eb4e096SRuslan Ermilov.include <bsd.obj.mk>
13046b13263SHiroki Satoclean: beforeclean
13112ad0bb1SNathan Whitehorn
13212ad0bb1SNathan Whitehornbase.txz:
133876acefaSHiroki Sato	mkdir -p ${DISTDIR}
13493e4813bSColin Percival	( cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} )
1358ee478dfSEd Maste	# Bootstrap etcupdate(8) database.
136e9ba25aaSJessica Clarke	sh ${WORLDDIR}/usr.sbin/etcupdate/etcupdate.sh extract -B \
137f3772439SJessica Clarke	    -m "${MAKE}" -M "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \
138f36b5d8aSJessica Clarke	    -s ${WORLDDIR} -d "${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate" \
139e972e408SGordon Tetlow	    -L /dev/null ${NO_ROOT:D-N}
140f36b5d8aSJessica Clarke.if defined(NO_ROOT)
141f36b5d8aSJessica Clarke	echo "./var/db/etcupdate type=dir uname=root gname=wheel mode=0755" >> ${.OBJDIR}/${DISTDIR}/base.meta
142f36b5d8aSJessica Clarke	sed -n 's,^\.,./var/db/etcupdate/current,p' ${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate/current/METALOG \
143f36b5d8aSJessica Clarke	    >> ${.OBJDIR}/${DISTDIR}/base.meta
144f36b5d8aSJessica Clarke	rm ${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate/current/METALOG
14513cb0041SJessica Clarke.endif
146bfc3bab8SNathan Whitehorn# Package all components
14793e4813bSColin Percival	( cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} )
148876acefaSHiroki Sato	mv ${DISTDIR}/*.txz .
14912ad0bb1SNathan Whitehorn
15012ad0bb1SNathan Whitehornkernel.txz:
151876acefaSHiroki Sato	mkdir -p ${DISTDIR}
15265c603edSColin Percival	( cd ${WORLDDIR} && ${IMAKE} distributekernel DISTDIR=${.OBJDIR}/${DISTDIR} )
15365c603edSColin Percival	( cd ${WORLDDIR} && ${IMAKE} packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} )
154876acefaSHiroki Sato	mv ${DISTDIR}/kernel*.txz .
15512ad0bb1SNathan Whitehorn
15612ad0bb1SNathan Whitehornsrc.txz:
157876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
15812ad0bb1SNathan Whitehorn	ln -fs ${WORLDDIR} ${DISTDIR}/usr/src
15993e4813bSColin Percival	( cd ${DISTDIR} && ${TAR_CMD} cLvf - --exclude .svn --exclude .zfs \
160bd9cab6fSRui Paulo	    --exclude .git --exclude @ --exclude usr/src/release/dist usr/src | \
16193e4813bSColin Percival	    ${XZ_CMD} > ${.OBJDIR}/src.txz )
16212ad0bb1SNathan Whitehorn
16312ad0bb1SNathan Whitehornports.txz:
164876acefaSHiroki Sato	mkdir -p ${DISTDIR}/usr
16512ad0bb1SNathan Whitehorn	ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports
16693e4813bSColin Percival	( cd ${DISTDIR} && ${TAR_CMD} cLvf - \
16723659c9dSGlen Barber	    --exclude .git --exclude .svn \
16812ad0bb1SNathan Whitehorn	    --exclude usr/ports/distfiles --exclude usr/ports/packages \
169bd9cab6fSRui Paulo	    --exclude 'usr/ports/INDEX*' --exclude work usr/ports | \
17093e4813bSColin Percival	    ${XZ_CMD} > ${.OBJDIR}/ports.txz )
17112ad0bb1SNathan Whitehorn
172a55e34ebSGlen Barberdisc1: packagesystem
17312ad0bb1SNathan Whitehorn# Install system
174a55e34ebSGlen Barber	mkdir -p ${.TARGET}
17593e4813bSColin Percival	( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
17613f7dbe8SEd Maste	    DESTDIR=${.OBJDIR}/${.TARGET} MK_AT=no \
1776853d893SJessica Clarke	    MK_INSTALLLIB=no MK_MAIL=no \
17832a79e85SJessica Clarke	    ${_ALL_LIBCOMPATS:@v@MK_LIB$v=no@} \
1793750ccefSEd Maste	    MK_TOOLCHAIN=no \
1804c0ef5dbSNathan Whitehorn	    MK_RESCUE=no MK_DICT=no \
1812502c66bSRoger Pau Monné	    MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no \
18293e4813bSColin Percival	    -DDB_FROM_SRC )
18312ad0bb1SNathan Whitehorn# Copy distfiles
184a55e34ebSGlen Barber	mkdir -p ${.TARGET}/usr/freebsd-dist
18547866cdcSColin Percival	for dist in MANIFEST $$(ls *.txz | grep -v container | grep -vE -- '(${base ${_ALL_libcompats}:L:ts|})-dbg'); \
186a55e34ebSGlen Barber	    do cp $${dist} ${.TARGET}/usr/freebsd-dist; \
187ffc6fb79SGlen Barber	done
18813cb0041SJessica Clarke.if defined(NO_ROOT)
18913cb0041SJessica Clarke	echo "./usr/freebsd-dist type=dir uname=root gname=wheel mode=0755" >> ${.TARGET}/METALOG
19047866cdcSColin Percival	for dist in MANIFEST $$(ls *.txz | grep -v container | grep -vE -- '(${base ${_ALL_libcompats}:L:ts|})-dbg'); \
19113cb0041SJessica Clarke	    do echo "./usr/freebsd-dist/$${dist} type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG; \
19213cb0041SJessica Clarke	done
19313cb0041SJessica Clarke.endif
194*7e2996c1SBjoern A. Zeeb.if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
195*7e2996c1SBjoern A. Zeeb# Install packages onto release media.
196*7e2996c1SBjoern A. Zeeb	${PKG_INSTALL} wifi-firmware-kmod-release
197*7e2996c1SBjoern A. Zeeb.endif
19812ad0bb1SNathan Whitehorn# Set up installation environment
199a55e34ebSGlen Barber	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
200a55e34ebSGlen Barber	echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
201a55e34ebSGlen Barber	echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
2028c14a409SGlen Barber	echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf
203a55e34ebSGlen Barber	echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf
2046e49372eSKyle Evans	echo kernels_autodetect=\"NO\" >> ${.TARGET}/boot/loader.conf
2052a90c47aSJessica Clarke	echo loader_menu_multi_user_prompt=\"Installer\" >> ${.TARGET}/boot/loader.conf
206a55e34ebSGlen Barber	cp ${.CURDIR}/rc.local ${.TARGET}/etc
20713cb0041SJessica Clarke.if defined(NO_ROOT)
20813cb0041SJessica Clarke	echo "./etc/resolv.conf type=link uname=root gname=wheel mode=0644 link=/tmp/bsdinstall_etc/resolv.conf" >> ${.TARGET}/METALOG
20913cb0041SJessica Clarke	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
21013cb0041SJessica Clarke	echo "./etc/sysctl.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
21113cb0041SJessica Clarke	echo "./boot/loader.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
21213cb0041SJessica Clarke	echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
21313cb0041SJessica Clarke.endif
214876acefaSHiroki Sato	touch ${.TARGET}
21512ad0bb1SNathan Whitehorn
21646c413feSNathan Whitehornbootonly: packagesystem
21746c413feSNathan Whitehorn# Install system
218a55e34ebSGlen Barber	mkdir -p ${.TARGET}
21993e4813bSColin Percival	( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
22013f7dbe8SEd Maste	    DESTDIR=${.OBJDIR}/${.TARGET} MK_AT=no \
221738919c0SBaptiste Daroussin	    MK_GAMES=no \
2226853d893SJessica Clarke	    MK_INSTALLLIB=no MK_MAIL=no \
22332a79e85SJessica Clarke	    ${_ALL_LIBCOMPATS:@v@MK_LIB$v=no@} \
2243750ccefSEd Maste	    MK_TOOLCHAIN=no \
22501d57ec0SBryan Drewery	    MK_RESCUE=no MK_DICT=no \
2262502c66bSRoger Pau Monné	    MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no \
22793e4813bSColin Percival	    -DDB_FROM_SRC )
22846c413feSNathan Whitehorn# Copy manifest only (no distfiles) to get checksums
229a55e34ebSGlen Barber	mkdir -p ${.TARGET}/usr/freebsd-dist
230a55e34ebSGlen Barber	cp MANIFEST ${.TARGET}/usr/freebsd-dist
23113cb0041SJessica Clarke.if defined(NO_ROOT)
23213cb0041SJessica Clarke	echo "./usr/freebsd-dist type=dir uname=root gname=wheel mode=0755" >> ${.TARGET}/METALOG
23313cb0041SJessica Clarke	echo "./usr/freebsd-dist/MANIFEST type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
23413cb0041SJessica Clarke.endif
23546c413feSNathan Whitehorn# Set up installation environment
236a55e34ebSGlen Barber	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
237a55e34ebSGlen Barber	echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
238a55e34ebSGlen Barber	echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
2398c14a409SGlen Barber	echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf
240a55e34ebSGlen Barber	echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf
2416e49372eSKyle Evans	echo kernels_autodetect=\"NO\" >> ${.TARGET}/boot/loader.conf
2422a90c47aSJessica Clarke	echo loader_menu_multi_user_prompt=\"Installer\" >> ${.TARGET}/boot/loader.conf
243a55e34ebSGlen Barber	cp ${.CURDIR}/rc.local ${.TARGET}/etc
24413cb0041SJessica Clarke.if defined(NO_ROOT)
24513cb0041SJessica Clarke	echo "./etc/resolv.conf type=link uname=root gname=wheel mode=0644 link=/tmp/bsdinstall_etc/resolv.conf" >> ${.TARGET}/METALOG
24613cb0041SJessica Clarke	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
24713cb0041SJessica Clarke	echo "./etc/sysctl.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
24813cb0041SJessica Clarke	echo "./boot/loader.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
24913cb0041SJessica Clarke	echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
25013cb0041SJessica Clarke.endif
25146c413feSNathan Whitehorn
252a55e34ebSGlen Barberdvd: packagesystem
253dc244562SGlen Barber# Install system
254dc244562SGlen Barber	mkdir -p ${.TARGET}
25593e4813bSColin Percival	( cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \
256ba7bd912SGlen Barber		DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \
2572502c66bSRoger Pau Monné		MK_TESTS=no MK_DEBUG_FILES=no \
25893e4813bSColin Percival		-DDB_FROM_SRC )
259dc244562SGlen Barber# Copy distfiles
260dc244562SGlen Barber	mkdir -p ${.TARGET}/usr/freebsd-dist
26147866cdcSColin Percival	for dist in MANIFEST $$(ls *.txz | grep -v container); \
262ffc6fb79SGlen Barber	    do cp $${dist} ${.TARGET}/usr/freebsd-dist; \
263ffc6fb79SGlen Barber	done
26413cb0041SJessica Clarke.if defined(NO_ROOT)
26513cb0041SJessica Clarke	echo "./usr/freebsd-dist type=dir uname=root gname=wheel mode=0755" >> ${.TARGET}/METALOG
26647866cdcSColin Percival	for dist in MANIFEST $$(ls *.txz | grep -v container); \
26713cb0041SJessica Clarke	    do echo "./usr/freebsd-dist/$${dist} type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG; \
26813cb0041SJessica Clarke	done
26913cb0041SJessica Clarke.endif
270*7e2996c1SBjoern A. Zeeb.if ${.MAKE.OS} == "FreeBSD" && (!defined(NOPKG) || empty(NOPKG))
271*7e2996c1SBjoern A. Zeeb# Install packages onto release media.
272*7e2996c1SBjoern A. Zeeb	${PKG_INSTALL} wifi-firmware-kmod-release
273*7e2996c1SBjoern A. Zeeb.endif
274dc244562SGlen Barber# Set up installation environment
275dc244562SGlen Barber	ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf
276dc244562SGlen Barber	echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf
277dc244562SGlen Barber	echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf
2788c14a409SGlen Barber	echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf
2797f100614SGlen Barber	echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf
2806e49372eSKyle Evans	echo kernels_autodetect=\"NO\" >> ${.TARGET}/boot/loader.conf
2812a90c47aSJessica Clarke	echo loader_menu_multi_user_prompt=\"Installer\" >> ${.TARGET}/boot/loader.conf
282dc244562SGlen Barber	cp ${.CURDIR}/rc.local ${.TARGET}/etc
28313cb0041SJessica Clarke.if defined(NO_ROOT)
28413cb0041SJessica Clarke	echo "./etc/resolv.conf type=link uname=root gname=wheel mode=0644 link=/tmp/bsdinstall_etc/resolv.conf" >> ${.TARGET}/METALOG
28513cb0041SJessica Clarke	echo "./etc/rc.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
28613cb0041SJessica Clarke	echo "./etc/sysctl.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
28713cb0041SJessica Clarke	echo "./boot/loader.conf type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
28813cb0041SJessica Clarke	echo "./etc/rc.local type=file uname=root gname=wheel mode=0644" >> ${.TARGET}/METALOG
28913cb0041SJessica Clarke.endif
290dc244562SGlen Barber	touch ${.TARGET}
291dc244562SGlen Barber
292a1bff973SColin Percivaldisc1-disc1 disc1-memstick: disc1
293a1bff973SColin Percival	mkdir ${.TARGET}
294a1bff973SColin Percival	tar -cf- -C disc1 . | tar -xf- -C ${.TARGET}
295a1bff973SColin Percival
296a1bff973SColin Percivalbootonly-bootonly bootonly-memstick: bootonly
297a1bff973SColin Percival	mkdir ${.TARGET}
298a1bff973SColin Percival	tar -cf- -C bootonly . | tar -xf- -C ${.TARGET}
299a1bff973SColin Percival
3008cec99b6SGlen Barberrelease.iso: disc1.iso
301a1bff973SColin Percivaldisc1.iso: disc1-disc1
302a1bff973SColin Percival	cd disc1-disc1 && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
30312ad0bb1SNathan Whitehorn
304dc244562SGlen Barberdvd1.iso: dvd pkg-stage
30513cb0041SJessica Clarke	cd dvd && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
306dc244562SGlen Barber
307a1bff973SColin Percivalbootonly.iso: bootonly-bootonly
308a1bff973SColin Percival	cd bootonly-bootonly && sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ../${.TARGET} .${NO_ROOT:D/METALOG} ${XTRADIR}
30946c413feSNathan Whitehorn
310cb95a96bSGlen Barbermemstick: memstick.img
311a1bff973SColin Percivalmemstick.img: disc1-memstick
312a1bff973SColin Percival	cd disc1-memstick && sh ${.CURDIR}/${TARGET}/make-memstick.sh .${NO_ROOT:D/METALOG} ../${.TARGET}
31312ad0bb1SNathan Whitehorn
314a9da1707SGlen Barbermini-memstick: mini-memstick.img
315a1bff973SColin Percivalmini-memstick.img: bootonly-memstick
316a1bff973SColin Percival	cd bootonly-memstick && sh ${.CURDIR}/${TARGET}/make-memstick.sh .${NO_ROOT:D/METALOG} ../${.TARGET}
317a9da1707SGlen Barber
3182e9b8c8cSEd Mastepackagesystem: ${DISTRIBUTIONS}
31947866cdcSColin Percival	sh ${.CURDIR}/scripts/make-manifest.sh $$(ls *.txz | grep -v container) > MANIFEST
320299a8b95SNathan Whitehorn	touch ${.TARGET}
32112ad0bb1SNathan Whitehorn
322567cbd8fSColin Percivalpkg-stage: dvd
32313cb0041SJessica Clarke# TODO: Support for -DNO_ROOT
3248f229143SGlen Barber.if !defined(NOPKG) || empty(NOPKG)
325fefd0439SGlen Barber	env PORTSDIR=${PORTSDIR} REPOS_DIR=${.CURDIR}/pkg_repos/ \
3266f50c4eaSGlen Barber		sh ${.CURDIR}/scripts/pkg-stage.sh
3270d0e89b7SGlen Barber	mkdir -p ${.OBJDIR}/dvd/packages/repos/
3280d0e89b7SGlen Barber	cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \
3290d0e89b7SGlen Barber		${.OBJDIR}/dvd/packages/repos/
330dc244562SGlen Barber.endif
3310d0e89b7SGlen Barber	touch ${.TARGET}
332dc244562SGlen Barber
3338cec99b6SGlen Barbercdrom: disc1.iso bootonly.iso
334dc244562SGlen Barberdvdrom: dvd1.iso
33512ad0bb1SNathan Whitehornftp: packagesystem
336299a8b95SNathan Whitehorn	rm -rf ftp
337876acefaSHiroki Sato	mkdir -p ftp
338299a8b95SNathan Whitehorn	cp *.txz MANIFEST ftp
339976e1d36SColin Percival	rm -f ftp/container-*.txz
34012ad0bb1SNathan Whitehorn
341d03c82c2SDoug Rabsonrelease:	real-release vm-release cloudware-release oci-release
342fdbd473cSGlen Barber	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} release-done
343fdbd473cSGlen Barber	true
344fdbd473cSGlen Barber
345fdbd473cSGlen Barberrelease-done:
346fdbd473cSGlen Barber	touch release
3474afe7cf5SGlen Barber
3484afe7cf5SGlen Barberreal-release:
3490bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj
3500bd47e83SNathan Whitehorn	${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS}
35112ad0bb1SNathan Whitehorn
352d03c82c2SDoug Rabsoninstall:	release-install vm-install oci-install .WAIT cloud-install
3532d4ff62fSGlen Barber
3542d4ff62fSGlen Barberrelease-install:
355876acefaSHiroki Sato.if defined(DESTDIR) && !empty(DESTDIR)
356876acefaSHiroki Sato	mkdir -p ${DESTDIR}
357876acefaSHiroki Sato.endif
358de17cbccSHiroki Sato	cp -a ftp ${DESTDIR}/
3593083b412SMitchell Horne.if !empty(IMAGES)
360de17cbccSHiroki Sato.for I in ${IMAGES}
361de17cbccSHiroki Sato	cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
362510f3303SGlen Barber. if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES)
363bd9cab6fSRui Paulo	${XZ_CMD} -k ${DESTDIR}/${OSRELEASE}-${I}
364cbc0e08aSGlen Barber. endif
365de17cbccSHiroki Sato.endfor
36693e4813bSColin Percival	( cd ${DESTDIR} && sha512 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA512 )
36793e4813bSColin Percival	( cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 )
3683083b412SMitchell Horne.endif
369a68d274bSGlen Barber
37029b282f3SGlen Barber.include "${.CURDIR}/Makefile.inc1"
3716513e474SGlen Barber.include "${.CURDIR}/Makefile.vm"
372d03c82c2SDoug Rabson.include "${.CURDIR}/Makefile.oci"
373