aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2004-07-14 18:45:26 +0800
committerkris <kris@FreeBSD.org>2004-07-14 18:45:26 +0800
commit8741befca54c805f951b2079eaae24d97ade5b8d (patch)
tree29f38888e30749631415d740ec6ba3532f97f2b9 /Tools
parent028e45e4d8bc706488498f901a24eedfaa53b1cb (diff)
downloadfreebsd-ports-gnome-8741befca54c805f951b2079eaae24d97ade5b8d.tar.gz
freebsd-ports-gnome-8741befca54c805f951b2079eaae24d97ade5b8d.tar.zst
freebsd-ports-gnome-8741befca54c805f951b2079eaae24d97ade5b8d.zip
Clean up the specified chroot (umount filesystems, and scrub the
directories likely to contain changed files).
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/clean-chroot36
1 files changed, 36 insertions, 0 deletions
diff --git a/Tools/portbuild/scripts/clean-chroot b/Tools/portbuild/scripts/clean-chroot
new file mode 100755
index 000000000000..196dc373a5f3
--- /dev/null
+++ b/Tools/portbuild/scripts/clean-chroot
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+arch=$1
+branch=$2
+chroot=$3
+noclean=$4
+
+# directories to clean
+cleandirs="/usr/local /usr/X11R6 /compat /var/db/pkg"
+
+#umount ${chroot}/proc
+
+if [ ${arch} = "i386" ]; then
+ chroot ${chroot} umount -f /compat/linux/proc
+fi
+
+umount -f ${chroot}/a/ports
+umount -f ${chroot}/usr/opt/doc
+umount -f ${chroot}/usr/src
+umount -f ${chroot}/dev
+
+if [ $noclean = 0 ]; then
+ rm -rf ${chroot}/tmp/*
+ for dir in ${cleandirs}; do
+ if ! rm -rf ${chroot}${dir} >/dev/null 2>&1; then
+ chflags -R noschg ${chroot}${dir}
+ rm -rf ${chroot}${dir} >/dev/null 2>&1
+ fi
+ done
+ chroot ${chroot} /sbin/ldconfig -R
+ if [ ${arch} = "i386" ]; then
+ chroot ${chroot} /sbin/ldconfig -aout -R
+ fi
+ rm -rf ${chroot}/var/db/pkg/*
+ rm -rf ${chroot}/used
+fi