File: sb2-exitreport

package info (click to toggle)
scratchbox2 2.2.4-1debian1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 5,392 kB
  • ctags: 5,239
  • sloc: ansic: 21,734; sh: 4,360; perl: 2,170; cpp: 1,913; makefile: 610; python: 184
file content (61 lines) | stat: -rwxr-xr-x 1,522 bytes parent folder | download
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
#
# This script will be started by sb2-monitor after "everything has been done"
#
# Copyright (c) 2008 Nokia Corporation. All rights reserved.
# Author: Lauri T. Aarnio
# Licensed under LGPL version 2.1, see top level LICENSE file for details.

exit_reason=$1
exit_status=$2

if [ -z "$SBOX_MAPPING_LOGFILE" -o \
     -z "$exit_reason" -o -z "$exit_status" ]; then
	echo "ERROR: $0 is an internal tool for sb2, do not use directly"
	exit 1
fi

if [ "$exit_reason" == "exit" ]; then
	# Normal exit
	ret=$exit_status
else
	echo "Exit reason and status: $exit_reason $exit_status"
	ret=1
fi

if [ -s "$SBOX_MAPPING_LOGFILE" ]; then
	# Logfile exists and is not empty
	# add reason and status to the logfile
	echo "# $* ($ret)" >> $SBOX_MAPPING_LOGFILE
	case "$SBOX_MAPPING_LOGLEVEL" in
	(error|warning|net)
		# Brief log, only error, warning and network-related messages.
		echo "Messages from sb2:"
		cat $SBOX_MAPPING_LOGFILE
		;;
	(*)
		# Larger log (maybe a debug log)
		echo "Log summary:"
		echo
		sb2-logz -v < $SBOX_MAPPING_LOGFILE
		echo
		echo "This log can be analyzed again by"
		echo "sb2-logz < $SBOX_MAPPING_LOGFILE"
		;;
	esac
elif [ -f "$SBOX_MAPPING_LOGFILE" ]; then
	# Log file exists, but is empty
	rm $SBOX_MAPPING_LOGFILE
fi

if [ -f $SBOX_SESSION_DIR/.joinable-session ]; then
	# The session was created with -S flag, don't clean it, but stay quiet
	echo >/dev/null
else
	# cleanup
	if [ -n "$SBOX_SESSION_DIR" -a -d "$SBOX_SESSION_DIR" ]; then
		rm -rf $SBOX_SESSION_DIR
	fi
fi

exit $ret