mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-03 06:04:53 +00:00
* Clean up this script a bit
* Require an additional <tmpdir> argument so the client knows where its temp directory is. * Mount the portbuild directory readonly via NFS, and copy files that way instead of via scp, which has too much overhead
This commit is contained in:
parent
e1b376a273
commit
1b934126ce
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=56567
@ -10,42 +10,50 @@ if [ "x$1" = "x-nocopy" ]; then
|
|||||||
nocopy=1
|
nocopy=1
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
if [ $# != 4 ]; then
|
|
||||||
echo "usage: $0 [-nocopy] master portbuilddir branch md5"
|
if [ $# != 5 ]; then
|
||||||
|
echo "usage: $0 [-nocopy] master portbuilddir branch tmpdir md5"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ $(echo $(/sbin/mount | grep "$2/.*read-only" | awk '{print $3}' | wc -c)) != 0 ]; then
|
|
||||||
/sbin/umount -f $(/sbin/mount | grep "$2/.*read-only" | awk '{print $3}')
|
master=$1
|
||||||
|
pb=$2
|
||||||
|
branch=$3
|
||||||
|
tmpdir=$4
|
||||||
|
md5master=$5
|
||||||
|
|
||||||
|
if [ $(echo $(/sbin/mount | grep "${pb}/.*read-only" | awk '{print $3}' | wc -c)) != 0 ]; then
|
||||||
|
/sbin/umount -f $(/sbin/mount | grep "${pb}/.*read-only" | awk '{print $3}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#cd $2
|
#cd ${pb}
|
||||||
#fs=$(df . | sed -e '1d' | awk '{print $6}')
|
#fs=$(df . | sed -e '1d' | awk '{print $6}')
|
||||||
|
|
||||||
#mount -u -w $fs
|
#mount -u -w $fs
|
||||||
|
|
||||||
if ! rm -rf $2/*/chroot/* >/dev/null 2>&1; then
|
cd ${tmpdir}
|
||||||
chflags -R noschg $2/*/chroot/*
|
|
||||||
rm -rf $2/*/chroot/*
|
mkdir -p ${tmpdir}/${branch}/chroot
|
||||||
|
|
||||||
|
# Clean up the tmpdir
|
||||||
|
# XXX Should try and unmount old nfs filesystems first
|
||||||
|
if ! rm -rf ${tmpdir}/${branch}/chroot/* >/dev/null 2>&1; then
|
||||||
|
chflags -R noschg ${tmpdir}/${branch}/chroot/*
|
||||||
|
rm -rf ${tmpdir}/${branch}/chroot/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
killall make fetch >/dev/null 2>&1
|
killall make fetch >/dev/null 2>&1
|
||||||
|
|
||||||
mkdir -p $2/scripts $2/$3/tarballs $2/$3/chroot
|
mkdir -p ${tmpdir}/${branch}/tarballs
|
||||||
|
|
||||||
scp -p $1:$2/scripts/portbuild $2/scripts
|
|
||||||
scp -p $1:$2/portbuild.conf $2
|
|
||||||
|
|
||||||
scp -p $1:$2/$3/UNAME_TARGET $2/$3/tarballs/
|
|
||||||
|
|
||||||
if [ "$nocopy" = 0 ]; then
|
if [ "$nocopy" = 0 ]; then
|
||||||
if [ -f $2/$3/tarballs/bindist.tar ]; then
|
if [ -f ${tmpdir}/${branch}/tarballs/bindist.tar ]; then
|
||||||
md5=$(/sbin/md5 $2/$3/tarballs/bindist.tar | awk '{print $4}')
|
md5=$(/sbin/md5 ${tmpdir}/${branch}/tarballs/bindist.tar | awk '{print $4}')
|
||||||
fi
|
fi
|
||||||
if [ "$md5" = "$4" ]; then
|
if [ "${md5}" = "${md5master}" ]; then
|
||||||
echo "not copying bindist to $(hostname -s) since it is already up to date"
|
echo "not copying bindist to $(hostname -s) since it is already up to date"
|
||||||
else
|
else
|
||||||
echo "copying bindist to $(hostname -s)"
|
echo "copying bindist to $(hostname -s)"
|
||||||
scp -p $1:$2/$3/tarballs/bindist.tar $2/$3/tarballs
|
cp -p ${pb}/${branch}/tarballs/bindist.tar ${tmpdir}/${branch}/tarballs
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user