diff options
Diffstat (limited to 'debian/building-in-ci.sh')
-rwxr-xr-x | debian/building-in-ci.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/debian/building-in-ci.sh b/debian/building-in-ci.sh new file mode 100755 index 0000000..ccf552d --- /dev/null +++ b/debian/building-in-ci.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# this script prints 'true' if any ancestor process name is any of $REGEXPS + +REGEXPS="debci autopkgtest adt" + +set -e + +walk() +{ + pid=$1 + + [ ! -r /proc/$pid/cmdline ] && exit 1 + + name=$(ps -p $pid -o cmd | tail -1) + for exp in $REGEXPS + do + if grep -e $exp <<< $name >/dev/null ; then + echo true + exit + fi + done + + ppid=$(ps -o ppid= $pid | tr -d ' ') + walk $ppid +} + +walk $$ |