3
# Copyright 2009 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
# Buildd Slave tool to scan a chroot in case any processes are underneath it
8
## This script uses bashisms, must be run under bash
10
# Expects build id as arg 1, makes build-id to contain the build
12
# Needs SUDO to be set to a sudo instance for passwordless access
16
REALHOME=$(cd $HOME && pwd -P)
22
[ $(id -u) = "0" ] || exec $SUDO $0 "$REALHOME/build-$BUILDID/chroot-autobuild"
24
echo "Scanning for processes to kill in build $BUILDID..."
29
for ROOT in /proc/*/root; do
30
LINK=$(readlink $ROOT)
31
if [ "x$LINK" != "x" ]; then
32
if [ "x${LINK:0:${#PREFIX}}" = "x$PREFIX" ]; then
33
# this process is in the chroot...
34
PID=$(basename $(dirname "$ROOT"))
41
if [ "x$FOUND" = "x1" ]; then