File: building-in-ci.sh

package info (click to toggle)
suricata 1%3A8.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 240,704 kB
  • sloc: ansic: 357,736; python: 8,721; sh: 5,043; makefile: 2,411; perl: 570; php: 170
file content (28 lines) | stat: -rwxr-xr-x 391 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 $$