summaryrefslogtreecommitdiffstats
path: root/core/modules/pvs2/data/opt/openslx/bin/pvsstartup
blob: 0207c268f83b8fc1b78e1f57fde02bf4ee7491d7 (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/ash

timediff=5
counter=0

. /opt/openslx/config
EXAM=
if [ -n "$SLX_EXAM" ]; then
	EXAM="--exam-mode"
fi

# Report core dumps
URL="http://132.230.8.113/error_report.php"
DIR=$(mktemp -d)
[ -n "$DIR" ] && cd "$DIR"

ulimit -c unlimited
exec &> "/tmp/xsession-log-pvsclient-$(date +%s)-$$"

while [ $timediff -gt 3 ]; do
	start="$(date +%s)"
	pvsclient $EXAM "$@"
	ret=$?
	end="$(date +%s)"
	[ "$ret" = 139 ] && for c in core*; do
		[ -f "$c" ] || continue
		tar ckzf "cmp-${c}.tgz" "$c" "/opt/openslx/.mltk/pvs2.git" "/etc/issue"
		curl -m 3 -H "Expect:" -f -s -S -F "file=@cmp-${c}.tgz;filename=report" "$URL" &> /dev/null
		rm -f -- "$c" "cmp-${c}.tgz"
	done
	/opt/openslx/pvs2/kb-unlock.sh
	[ "$ret" == "0" ] && break
	timediff=$(( end - start ))
	counter=$(( counter + 1 ))
	[ $counter -gt 8 ] && break
done

rm -rf -- "$DIR"

exit $ret