mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-26 09:46:09 +00:00
2df0e38d60
* Use a generation number for the bindist tarballs, with compatibility symlink. Eventually we'll use this to avoid building in a "stale" chroot (i.e. populated by old world). * Don't bother running ldconfig on i386, it is evidently not needed since the other arches work fine without it
107 lines
2.4 KiB
Bash
Executable File
107 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
usage () {
|
|
echo "usage: mkbindist <arch> <branch>"
|
|
exit 1
|
|
}
|
|
if [ $# != 2 ]; then
|
|
usage
|
|
fi
|
|
|
|
arch=$1
|
|
branch=$2
|
|
if [ "x$branch" != x4 -a "x$branch" != x5 -a "x$branch" != x6-exp -a "x$branch" != x6 -a "x$branch" != x7 ]; then
|
|
usage
|
|
fi
|
|
|
|
pb=/var/portbuild
|
|
. ${pb}/${arch}/portbuild.conf
|
|
|
|
here=${pb}/${arch}/${branch}
|
|
. ${here}/mkbindist.conf
|
|
|
|
if [ ${buildworld} = "1" ]; then
|
|
if ! ${pb}/scripts/makeworld ${arch} ${branch}; then
|
|
exit 1
|
|
fi
|
|
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
|
|
|
|
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)
|
|
(cd ${here}/bindist/files; find -dx . | cpio -dump ${tmpdir})
|
|
|
|
# Post-processing of installed world
|
|
date '+%Y%m%d' > var/db/port.mkversion
|
|
rm -f kernel.GENERIC
|
|
mkdir ${tmpdir}/var/run
|
|
|
|
# Create the tarballs
|
|
mkdir -p ${here}/tarballs
|
|
|
|
if [ -f ${here}/tarballs/.gen ]; then
|
|
gen=$(cat ${here}/tarballs/.gen)
|
|
else
|
|
gen=0
|
|
fi
|
|
newgen=$((${gen}+1))
|
|
|
|
cd ${tmpdir}
|
|
tar cf ${here}/tarballs/bindist.tar.new .
|
|
rm -f ${here}/tarballs/bindist-${gen}.tar
|
|
mv -f ${here}/tarballs/bindist.tar.new ${here}/tarballs/bindist-${newgen}.tar
|
|
ln -sf ${here}/tarballs/bindist-${newgen}.tar ${here}/tarballs/bindist.tar
|
|
|
|
# Clean up
|
|
cd ${here}
|
|
rm -rf ${tmpdir} 2>/dev/null
|
|
if [ -d ${tmpdir} ]; then
|
|
chflags -R noschg ${tmpdir}
|
|
rm -rf ${tmpdir}
|
|
fi
|