aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2002-02-24 16:01:54 +0800
committerkris <kris@FreeBSD.org>2002-02-24 16:01:54 +0800
commitcc489f806567ffc29bb36fefc186c58a7caedb6c (patch)
treedd25cda17a11dfd758bf94ee8fe701075d18e829 /Tools
parentf2d91f8d17d5351387a06b356cbb4ec62e38a0f7 (diff)
downloadfreebsd-ports-gnome-cc489f806567ffc29bb36fefc186c58a7caedb6c.tar.gz
freebsd-ports-gnome-cc489f806567ffc29bb36fefc186c58a7caedb6c.tar.zst
freebsd-ports-gnome-cc489f806567ffc29bb36fefc186c58a7caedb6c.zip
Clean up this script a bit:
* Don't require the script to be called from inside the branch directory; follow standard practise and pass the branch to build as an argument. * Populate the chroot with the BSD.local.dist mtree file * Add whitespace for readability, and sprinkle liberally with comments * Comment on some inscrutable parts of the script which were presumably put there to work around a (perceived) problem, but which I can't understand.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/mkbindist73
1 files changed, 60 insertions, 13 deletions
diff --git a/Tools/portbuild/scripts/mkbindist b/Tools/portbuild/scripts/mkbindist
index 4cb8351a031d..e7cf397d5a77 100755
--- a/Tools/portbuild/scripts/mkbindist
+++ b/Tools/portbuild/scripts/mkbindist
@@ -1,16 +1,38 @@
#!/bin/sh
-here=$(pwd)
+
+usage () {
+ echo "usage: mkbindist <branch>"
+ exit 1
+}
+if [ $# != 1 ]; then
+ usage
+fi
+
+branch=$1
+if [ "x$branch" != x4 -a "x$branch" != x4-exp -a "x$branch" != x5 ]; then
+ usage
+fi
+
+pb=/var/portbuild
+. ${pb}/portbuild.conf
+
+here=${pb}/${branch}
. ${here}/mkbindist.conf
-chrootdir=/var/chroot
+
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}
+
+# FTP the snapshot tarball chunks if required
if [ "${ftp}" != 0 ]; then
rm -rf bindist/ftp
mkdir -p bindist/ftp
@@ -20,9 +42,18 @@ if [ "${ftp}" != 0 ]; then
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 ${chrootdir}; find -dx . | \
+ (cd ${worlddir}; find -dx . | \
grep -v -E '^./usr/(X11R6|local|obj|opt|ports|src)' | \
grep -v '^./home' | \
grep -v '^./var/db/pkg' | \
@@ -32,43 +63,59 @@ else
cat ${here}/bindist/ftp/$(basename $i).?? | tar --unlink -xzpf -
done
fi
+
+# Customize the tmpdir
rm -rf $(cat ${here}/bindist/delete)
mkdir -p $(cat ${here}/bindist/dirlist)
(cd ${here}/bindist/files; find -dx . | cpio -dump ${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
-#echo "HAVE_MOTIF=t" >> etc/make.conf
-#echo "MOTIF_STATIC=t" >> etc/make.conf
-#echo "LOADER_TFTP_SUPPORT=YES" >> etc/make.conf
+
+# Post-processing of installed world
+
date '+%Y%m%d' > var/db/port.mkversion
-#if [ -f kernel.GENERIC -a ! -f kernel ]; then
-# mv kernel.GENERIC kernel
-#fi
+
rm -f kernel.GENERIC
rm -f /usr/lib/aout/lib*_p.a
+
mkdir ${tmpdir}/var/run
+
chroot ${tmpdir} /sbin/ldconfig /usr/lib
chroot ${tmpdir} /sbin/ldconfig -aout /usr/lib/aout
#sed -e "s/%%KERNEL%%/${kernel}/g" ${here}/dokernel > ${tmpdir}/dokernel
+
+# XXX Rebuild kernel for some reason. No idea why, and
+# note that it's using the source tree which is cvs
+# updated during the port build process, which is
+# usually newer than the host environment and the chroot.
+
mount localhost:${here}/src ${tmpdir}/usr/src
-sleep 5
+sleep 5 # XXX !!!
+
+# Cater to different build locations of 4.x and 5.x
if [ -d ${here}/src/sys/i386/compile ]; then
chroot ${tmpdir} sh -c "cd /usr/src/sys/i386/conf && config ${kernel} && cd /sys/i386/compile/${kernel} && make depend -DNO_MODULES && make all install -DNO_MODULES"
else
chroot ${tmpdir} sh -c "cd /usr/src/sys/i386/conf && config ${kernel} && cd /sys/compile/${kernel} && make depend -DNO_MODULES && make all install -DNO_MODULES"
fi
+
#chroot ${tmpdir} sh -c "cd /usr/src/sys/boot && make obj && make depend && make all install"
umount -f ${tmpdir}/usr/src
rm -rf ${tmpdir}/kernel.old ${tmpdir}/modules.old ${tmpdir}/boot/kernel.old
+
+# Rebuild device nodes. Again, this was probably intended
+# to make sure they're correct for the host kernel, not
+# the chroot kernel, but it's using the wrong source tree.
if [ -f ${here}/src/etc/MAKEDEV ]; then
cp ${here}/src/etc/MAKEDEV ${tmpdir}/dev
else
cp ${here}/src/etc/etc.$(uname -m)/MAKEDEV ${tmpdir}/dev
fi
+
+# Create the tarballs
mkdir -p ${here}/tarballs
tar cf ${here}/tarballs/bindist.tar.new .
mv -f ${here}/tarballs/bindist.tar.new ${here}/tarballs/bindist.tar
+
+# Clean up
cd ${here}
rm -rf ${tmpdir} 2>/dev/null
if [ -d ${tmpdir} ]; then