From c5c00325364b49ffc9ea235abc9a0a3f9b351cc3 Mon Sep 17 00:00:00 2001 From: Kris Kennaway Date: Sat, 22 Feb 2003 22:22:12 +0000 Subject: [PATCH] If ${buildworld}=1 in mkbindist.conf, then use the makeworld script to build world and populate the chroot. Otherwise, if ${ftp}=1 then fetch it from the ftp site as before. --- Tools/portbuild/scripts/mkbindist | 92 +++++++++++++++---------------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/Tools/portbuild/scripts/mkbindist b/Tools/portbuild/scripts/mkbindist index e2f1ca1b229c..2b4d4e4a9f55 100755 --- a/Tools/portbuild/scripts/mkbindist +++ b/Tools/portbuild/scripts/mkbindist @@ -20,61 +20,57 @@ pb=/var/portbuild here=${pb}/${arch}/${branch} . ${here}/mkbindist.conf -if [ ${ftp} = "0" ]; then +if [ ${buildworld} = "1" ]; then if ! ${pb}/scripts/makeworld ${arch} ${branch}; then exit 1 fi - tmpdir=/var/chroot/ -else - tmpdir=${here}/tmp +elif [ ${ftp} = "1" ]; then + cd ${here} + rm -rf bindist/ftp + mkdir -p bindist/ftp + cd bindist/ftp + for i in ${ftpdists}; do + /usr/bin/ftp -a "ftp://${ftpserver}${ftpurl}/${rel}/$i.??" + done + cd ${here} +fi - # just in case - umount -f ${tmpdir}/usr/src 2>/dev/null - - # Clean up ${tmpdir} - rm -rf ${tmpdir} 2>/dev/null - if [ -d ${tmpdir} ]; then - chflags -R noschg ${tmpdir} - rm -rf ${tmpdir} - fi - mkdir -p ${tmpdir} - - # FTP the snapshot tarball chunks if required - if [ "${ftp}" != 0 ]; then - cd ${here} - rm -rf bindist/ftp - mkdir -p bindist/ftp - cd bindist/ftp - for i in ${ftpdists}; do - /usr/bin/ftp -a "ftp://${ftpserver}/${ftpurl}/${rel}/$i.??" - done - cd ${here} - fi - - # Set up the tmpdir directory hierarchy - cd ${tmpdir} - mtree -deU -f ${here}/src/etc/mtree/BSD.root.dist -p ${tmpdir}/ - mtree -deU -f ${here}/src/etc/mtree/BSD.var.dist -p ${tmpdir}/var - mtree -deU -f ${here}/src/etc/mtree/BSD.usr.dist -p ${tmpdir}/usr - mtree -deU -f ${here}/src/etc/mtree/BSD.local.dist -p ${tmpdir}/usr/local - - # Copy the files into the tmpdir. Use an existing built world, or the ftp - # files. - if [ "${useworld}" = 1 ]; then - (cd ${worlddir}; find -dx . | \ - grep -v -E '^./usr/(X11R6|local|obj|opt|ports|src)' | \ - grep -v '^./home' | \ - grep -v '^./var/db/pkg' | \ - cpio -dump ${tmpdir}) - else - for i in ${ftpdists}; do - cat ${here}/bindist/ftp/$(basename $i).?? | tar --unlink -xzpf - - done - fi +tmpdir=${here}/tmp + +# just in case +umount -f ${tmpdir}/usr/src 2>/dev/null + +# Clean up ${tmpdir} +rm -rf ${tmpdir} 2>/dev/null +if [ -d ${tmpdir} ]; then + chflags -R noschg ${tmpdir} + rm -rf ${tmpdir} +fi +mkdir -p ${tmpdir} + +# Set up the tmpdir directory hierarchy +cd ${tmpdir} +mtree -deU -f ${here}/src/etc/mtree/BSD.root.dist -p ${tmpdir}/ +mtree -deU -f ${here}/src/etc/mtree/BSD.var.dist -p ${tmpdir}/var +mtree -deU -f ${here}/src/etc/mtree/BSD.usr.dist -p ${tmpdir}/usr +mtree -deU -f ${here}/src/etc/mtree/BSD.local.dist -p ${tmpdir}/usr/local + +# Copy the files into the tmpdir. Use an existing built world, or the ftp +# files. +if [ "${ftp}" = 0 ]; then + (cd ${worlddir}; find -dx . | \ + grep -v -E '^./usr/(X11R6|local|obj|opt|ports|src)' | \ + grep -v '^./home' | \ + grep -v '^./var/db/pkg' | \ + cpio -dump ${tmpdir}) +else + for i in ${ftpdists}; do + cat ${here}/bindist/ftp/$(basename $i).?? | tar --unlink -xzpf - + done fi cd ${tmpdir} - + # Customize the tmpdir rm -rf $(cat ${here}/bindist/delete) mkdir -p $(cat ${here}/bindist/dirlist)