Patch to src/nrelease/Makefile to ease live CD ISO building

看板DFBSD_submit作者時間21年前 (2004/06/06 13:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
This is a multi-part message in MIME format. --Multipart=_Sat__5_Jun_2004_13_38_03_-0700_eIR841rd6quEEyFb Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hey all, As you may or may not know or care, I've been working a lot on the installer lately, and apropos to that, I needed a way to get what we have of the installer software onto a live CD image. To this end, I've made some modifications to src/nrelease/Makefile to make customizing live CD's easier. The major differences in it are how it treats packages and root skeletons. Instead of simply requiring that mkisofs and cvsup are installed on the host machine and copying those binaries over, it requires that the package files mkisofs.tgz and cvsup-without-gui.tgz exist on the host machine, and it installs them onto the live CD image by chroot'ing and pkg_add'ing them (I originally tried just using `pkg_add -p' but that appears to be horribly broken for some packages; thanks go to GeekGod for supplying this chroot magic.) Moreover, the user can change where the packages are obtained from by setting PACKAGES_LOC, and can specify further packages to install on the image by setting EXTRA_PACKAGES. (This is how we've been getting the installer on the test ISO's) This is all done with a new `pkgaddiso' target, which is required by all the release targets. Additionally, there is a seperate `pkgcleaniso' target which can be used to remove all packages from the ISODIR. To cover customization needs that can't be handled with packages, the patch also allows the user to specify additional root skeletons. A root skeleton is just a directory tree with files which will be copied over the existing files in the ISODIR. src/nrelease/root is one such root skeleton, and in fact, it is the required root skeleton. The user may specify additional root skeletons with the EXTRA_ROOTSKELS variable. Each root skeleton overwrites the files in the last. This is all done in the new `customizeiso' target. cpdup is used to copy the root skeletons into the ISODIR. Also, after all root skeletons are copied, a single `find' sweep is used to remove the CVS directories, instead of relying on cpignore files, which don't scale well in this instance (there would need to be one per directory.) Lastly, there is a small change to the `clean' target: it deletes the contents of ISOROOT, rather than ISOROOT itself. This is because I have ISOROOT mounted on a dedicated partition (which seems reasonable, and is handy for testing the live-cd-to-be without actually burning it to a real CD or even creating an .iso file.) This patch will have the following impact on people currently making releases (notably Matt and Simon:) * You need mkisofs.tgz and cvsup-without-gui.tgz on (or fetchable by) the host machine. By default they're expected in /usr/ports/packages/Latest/, but this can be changed by setting PACKAGES_LOC. It can be a URL, in which case the packages will be fetched by pkg_add in the usual way. * All of the files in those packages will be present on the generated ISO (i.e. not just /usr/local/bin/mkisofs, but also /usr/local/bin/isodump et al.) Everything else should work the same. Let me know what you think. Thanks, -Chris --Multipart=_Sat__5_Jun_2004_13_38_03_-0700_eIR841rd6quEEyFb Content-Type: text/plain; name="nrelease__Makefile.diff" Content-Disposition: attachment; filename="nrelease__Makefile.diff" Content-Transfer-Encoding: 7bit Index: Makefile =================================================================== RCS file: /home/dcvs/src/nrelease/Makefile,v retrieving revision 1.8 diff -u -r1.8 Makefile --- Makefile 23 Apr 2004 02:14:07 -0000 1.8 +++ Makefile 5 Jun 2004 19:38:09 -0000 @@ -7,6 +7,23 @@ OBJSYS= ${.OBJDIR}/../sys KERNCONF ?= GENERIC +# Specify which packages are required on the ISO, and let the user +# specify additional packages to include. During the `pkgaddiso' +# target, the packages are obtained from PACKAGES_LOC, which can +# be either a directory name or a URL; in either case, it must end +# with a slash. +# +REQ_PACKAGES= mkisofs cvsup-without-gui +PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES} +PACKAGES_LOC?= /usr/ports/packages/Latest/ + +# Specify which root skeletons are required, and let the user include +# their own. They are copied into ISODIR during the `pkgcustomizeiso' +# target; each overwrites the last. +# +REQ_ROOTSKELS= ${.CURDIR}/root +ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS} + # note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add # the additional '/nrelease' manually, as a safety measure. # @@ -15,11 +32,14 @@ WORLD_CCVER ?= ${CCVER} KERNEL_CCVER ?= ${CCVER} -release: check clean buildworld1 buildkernel1 buildiso mkiso +release: check clean buildworld1 buildkernel1 \ + buildiso customizeiso pkgaddiso mkiso -quickrel: check clean buildworld2 buildkernel2 buildiso mkiso +quickrel: check clean buildworld2 buildkernel2 \ + buildiso customizeiso pkgaddiso mkiso -realquickrel: check clean buildiso mkiso +realquickrel: check clean \ + buildiso customizeiso pkgaddiso mkiso check: if [ ! -f /usr/local/bin/mkisofs ]; then \ @@ -51,16 +71,44 @@ if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld ) ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease make DESTDIR=${ISOROOT} distribution ) - cpdup -X cpignore -o ${.CURDIR}/root ${ISOROOT} -vv ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \ installkernel KERNCONF=${KERNCONF} ) mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/ mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev - cp /usr/local/bin/mkisofs ${ISOROOT}/usr/local/bin - cp /usr/local/man/man8/mkisofs.8.gz ${ISOROOT}/usr/local/man/man8 - cp /usr/local/bin/cvsup ${ISOROOT}/usr/local/bin - cp /usr/local/man/man1/cvsup.1.gz ${ISOROOT}/usr/local/man/man1 + +customizeiso: +.for ROOTSKEL in ${ROOTSKELS} + cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT} +.endfor + rm -rf `find ${ISOROOT} -type d -name CVS -print` + +pkgcleaniso: + echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript + echo "pkg_delete '*'" >> ${ISOROOT}/tmp/chrootscript + chmod a+x ${ISOROOT}/tmp/chrootscript + chroot ${ISOROOT}/ /tmp/chrootscript + rm ${ISOROOT}/tmp/chrootscript + +pkgaddiso: + cp /etc/resolv.conf ${ISOROOT}/etc/resolv.conf +.for PKG in ${PACKAGES} + echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript + echo "echo 'Installing package ${PKG}...'" >> ${ISOROOT}/tmp/chrootscript + if [ -d "${PACKAGES_LOC}" ]; then \ + cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp && \ + echo "pkg_add /tmp/${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript ; \ + else \ + echo "pkg_add ${PACKAGES_LOC}${PKG}.tgz" >> ${ISOROOT}/tmp/chrootscript ; \ + fi + chmod a+x ${ISOROOT}/tmp/chrootscript + chroot ${ISOROOT}/ /tmp/chrootscript + rm ${ISOROOT}/tmp/chrootscript + if [ -d "${PACKAGES_LOC}" ]; then \ + rm ${ISOROOT}/tmp/${PKG}.tgz ; \ + fi +.endfor + rm ${ISOROOT}/etc/resolv.conf mkiso: ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \ @@ -68,7 +116,7 @@ clean: if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi - if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}; fi + if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi realclean: clean --Multipart=_Sat__5_Jun_2004_13_38_03_-0700_eIR841rd6quEEyFb--
文章代碼(AID): #10mgKH00 (DFBSD_submit)