mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-02 06:03:50 +00:00
* 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.
This commit is contained in:
parent
50a3a73c61
commit
89b70a6115
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=155730
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user