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.
This commit is contained in:
Kris Kennaway 2003-02-22 22:22:12 +00:00
parent 2629774416
commit c5c0032536
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=76204

View File

@ -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)