Archival non-working checkin of the experimental build tool.

This commit is contained in:
David Given
2016-06-05 10:39:29 +02:00
parent ffc03090ea
commit d0bfee142b
2 changed files with 286 additions and 0 deletions

32
first/bouncer Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
set -e
set -x
logfile=/tmp/bouncer.$$
trap "rm -f $logfile" EXIT
if [ S"$1" = S"" ]; then
>&2 echo "bouncer: syntax error: BOUNCER_WHITELIST=... bouncer <command>"
exit 1
fi
strace -eopen,chdir -o $logfile -f "$@"
awk -f- -F '[ "()]+' $logfile <<"EOF"
BEGIN {
split(ENVIRON["BOUNCER_WHITELIST"], whitelist_array, " +");
for (i in whitelist_array)
whitelist[whitelist_array[i]] = 1;
}
$2 == "chdir" {
print "pid ", $1, " chdir: ", $3;
}
($2 == "open") && ($5 !~ /O_CREAT/) && ($7 != -1) {
print "pid ", $1, " open: ", $3, $7;
}
EOF