aboutsummaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2006-02-11 18:05:01 +0800
committerkris <kris@FreeBSD.org>2006-02-11 18:05:01 +0800
commit9ec05089ce3a6c5e2d50418c9a61805aa974a5dd (patch)
tree69533f2a359cc03e59847d9a17376811d28866c3 /Tools
parent7023f038811c88ad1222cfeda57b5e08c9ffc4fe (diff)
downloadfreebsd-ports-gnome-9ec05089ce3a6c5e2d50418c9a61805aa974a5dd.tar.gz
freebsd-ports-gnome-9ec05089ce3a6c5e2d50418c9a61805aa974a5dd.tar.zst
freebsd-ports-gnome-9ec05089ce3a6c5e2d50418c9a61805aa974a5dd.zip
* In kill_procs(), pass in the directory and mountpoint as separate
arguments (cosmetic) * Detect if a chroot was used to run a jailed build, and first attempt to gracefully shut it down by killing everything within using pgrep(1) This has a much higher chance of succeeding that relying on fstat to identify processes that might interfere with our attempts to clean up mountpoints, which is fragile (libkvm-dependent), and inherently unreliable at best.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/clean-chroot10
1 files changed, 8 insertions, 2 deletions
diff --git a/Tools/portbuild/scripts/clean-chroot b/Tools/portbuild/scripts/clean-chroot
index a72238432574..24491e9f6820 100755
--- a/Tools/portbuild/scripts/clean-chroot
+++ b/Tools/portbuild/scripts/clean-chroot
@@ -3,10 +3,11 @@
kill_procs()
{
dir=$1
+ mount=$2
pids="XXX"
while [ ! -z "${pids}" ]; do
- pids=$(fstat -f "$dir" | tail +2 | awk '{print $3}' | sort -u)
+ pids=$(fstat -f "${dir}${mount}" | tail +2 | awk '{print $3}' | sort -u)
if [ ! -z "${pids}" ]; then
echo "Killing off pids in ${dir}"
ps -p $pids
@@ -26,7 +27,7 @@ cleanup_mount() {
umount ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} failed!"
fi
if [ "${mdir}" = "${chroot}${mount}" ]; then
- kill_procs ${chroot}${mount}
+ kill_procs ${chroot} ${mount}
umount ${chroot}${mount} || echo "Cleanup of ${chroot}${mount} failed!"
fi
fi
@@ -55,6 +56,11 @@ if [ `realpath ${chroot}` = "/" ]; then
exit 1
fi
+if [ -f ${chroot}/tmp/jail.id ]; then
+ pgrep -lfj `awk '{print $1}' ${chroot}/tmp/jail.id`
+ pkill -j `awk '{print $1}' ${chroot}/tmp/jail.id`
+fi
+
#umount ${chroot}/proc
if [ ${arch} = "i386" ]; then