forked from Lainports/freebsd-ports
tells us whether the node has NFS access to the master. * Also copy the bindist-$(hostname).tar file to allow local customization of the build chroots (e.g. resolv.conf and make.conf files for disconnected systems) * For disconnected hosts, we don't copy the bindist files from the master, but just set up the local directories and let the server rsync them into place later. Also set up dangling symlinks to the bindist files in the build area, which will be filled in by the server too (in the NFS case it makes sense to cache the bindist files locally to avoid extra NFS traffic, but here we know the file is local so a symlink is fine) * Remove an apparently spurious 'killall fetch' that snuck in for what were probably transient reasons. * Forcibly clean up old chroot directories since we are preparing to start another build and don't want old (possibly orphaned) builds to skew the job scheduling or use up resources.
61 lines
2 KiB
Bash
Executable file
61 lines
2 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Script run on the clients, to set them up in preparation for building
|
|
# packages. This includes setting up parts of the /var/portbuild
|
|
# directory hierarchy, the portbuild script and the bindist.tar file
|
|
# for populating the build chroots.
|
|
|
|
nocopy=0
|
|
if [ "x$1" = "x-nocopy" ]; then
|
|
nocopy=1
|
|
shift
|
|
fi
|
|
|
|
if [ $# != 7 ]; then
|
|
echo "usage: $0 [-nocopy] master portbuilddir arch branch tmpdir md5 disconnected"
|
|
exit 1
|
|
fi
|
|
|
|
master=$1
|
|
pb=$2
|
|
arch=$3
|
|
branch=$4
|
|
tmpdir=$5
|
|
md5master=$6
|
|
disconnected=$7
|
|
|
|
cd ${tmpdir}
|
|
|
|
mkdir -p ${tmpdir}/${branch}/chroot
|
|
mkdir -p ${tmpdir}/${branch}/tarballs
|
|
if [ "$nocopy" = 0 ]; then
|
|
if [ -f ${tmpdir}/${branch}/tarballs/bindist.tar ]; then
|
|
md5=$(/sbin/md5 ${tmpdir}/${branch}/tarballs/bindist.tar | awk '{print $4}')
|
|
fi
|
|
if [ "${md5}" = "${md5master}" ]; then
|
|
echo "not copying bindist to $(hostname) since it is already up to date"
|
|
else
|
|
echo "copying bindist to $(hostname)"
|
|
if [ ${disconnected} = 0 ]; then
|
|
cp -p ${pb}/${arch}/${branch}/tarballs/bindist.tar ${tmpdir}/${branch}/tarballs
|
|
cp -p ${pb}/${arch}/${branch}/tarballs/bindist-$(hostname).tar ${tmpdir}/${branch}/tarballs
|
|
fi
|
|
fi
|
|
if [ ${disconnected} = 1 ]; then
|
|
# Prepare all directories, they will be populated by a rsync push from the master
|
|
mkdir -p ${pb}/scripts ${pb}/${arch}/${branch}/ports ${pb}/${arch}/${branch}/src ${pb}/${arch}/${branch}/src ${pb}/${arch}/${branch}/tarballs
|
|
# bindist is a local file, so we don't have to worry about whether nfs caches it
|
|
# This symlink will dangle until the rsync comes along and fills in the destination.
|
|
ln -sf ${pb}/${arch}/${branch}/tarballs/bindist.tar ${tmpdir}/${branch}/tarballs
|
|
ln -sf ${pb}/${arch}/${branch}/tarballs/bindist-$(hostname).tar ${tmpdir}/${branch}/tarballs
|
|
fi
|
|
fi
|
|
|
|
# Clean up the tmpdir
|
|
for i in ${tmpdir}/${branch}/chroot/*; do
|
|
${pb}/scripts/clean-chroot ${arch} ${branch} ${i} 0
|
|
if ! rm -rf $i > /dev/null 2>&1; then
|
|
chflags -R noschg ${i}
|
|
rm -rf ${i}
|
|
fi
|
|
done
|