~louis/crashdc/trunk

18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
1
# /bin/sh
59 by bouchardl
Updated/added copyright header
2
# *****************************************************************
3
# *                                                               *
4
# *   Copyright 2009 Hewlett-Packard Development Company, L.P.    *
5
# *                                                               *
6
# *   crashdc may be copied only under the terms of the GNU       *
7
# *   General Public License, which may be found in the source    *
8
# *   kit.                                                        *
9
# *                                                               *
10
# *****************************************************************
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
11
21 by bouchardl
First working version on S11
12
#
13
# In order for this script to run correctly on SLES11,
14
# the crashkernel= boot param must be modified in order
15
# to increase the reserved memory that kexec will use.
16
# crashdc has been tested with the following :$
17
# crashkernel=256M-:128M@16M
18
#
19
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
20
#KDUMPSUCCESS=$1
21
#
22
# Changed for test
23
#
24
KDUMPSUCCESS=0
25
CRASHDCSUCCESS=0
26
35 by bouchardl
Added /etc/sysconfig file for sles11
27
. /etc/sysconfig/crashdc
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
28
. /etc/sysconfig/kdump
29
. /etc/rc.status
30
31
KDUMPSUCCESS=$?
32
33
if [ $KDUMPSUCCESS == 0 ];then
35 by bouchardl
Added /etc/sysconfig file for sles11
34
	crashexe=${MOUNTPREFIX}${CRASHEXE}
38 by bouchardl
Added CRASHDCDEBUG functionality
35
	coredir=`ls -rt ${MOUNTPREFIX}${VMCOREDIR}`
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
36
	set +a $coredir
37
	numdir=$#
38
	((numdir-=1))
39
	shift $numdir
35 by bouchardl
Added /etc/sysconfig file for sles11
40
	coredir=${MOUNTPREFIX}${VMCOREDIR}/$1
21 by bouchardl
First working version on S11
41
	namelist=$coredir/vmlinux-$(uname -r)
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
42
	namelist=${namelist%-kdump}
43
	if ! [ -r $namelist ];then
44
		#
39 by bouchardl
Removed deflating of namelist. crash accepts compressed namelists
45
		# namelist might have been uncompressed
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
46
		#
99 by louis_bouchard
Bugfix,Reformatted error msg
47
		if [ -f ${namelist}.gz ];then
48
			gzip -d -c ${namelist}.gz > $namelist
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
49
		else
99 by louis_bouchard
Bugfix,Reformatted error msg
50
			$LOGGER "Unable to locate $namelist. Verify that the \
51
			kernel-debuginfo packages are correctly installed \
52
			or uncompressed."
21 by bouchardl
First working version on S11
53
			false
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
54
			rc_status -v
55
			exit 1
56
		fi
57
	fi
99 by louis_bouchard
Bugfix,Reformatted error msg
58
	debuginfo=${MOUNTPREFIX}/usr/lib/debug/boot/vmlinux-$(uname -r).debug
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
59
21 by bouchardl
First working version on S11
60
	if ! [ -r $debuginfo ];then
99 by louis_bouchard
Bugfix,Reformatted error msg
61
		$LOGGER "Unable to locate $debuginfo. Verify that the \
62
		kernel-debuginfo packages are correctly installed \
63
		or uncompressed."
21 by bouchardl
First working version on S11
64
		false
65
		rc_status -v
66
		exit 1
67
	fi
68
39 by bouchardl
Removed deflating of namelist. crash accepts compressed namelists
69
	${CRASHDC} ${CRASHDCDEBUG} -x $crashexe $namelist $coredir/vmcore $coredir $debuginfo
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
70
	CRASHDCSUCCESS=$?
71
	if [ $CRASHDCSUCCESS == 0 ];then
72
		$LOGGER "generated a crash-data file to $coredir"
73
		rc_status -v
74
		exit 0
75
	else
76
		$LOGGER "Unable to generate a crash-data file"
21 by bouchardl
First working version on S11
77
		false
18 by bouchardl
SLES11 specific run script. Since SLES11 runtime environment is an initrd
78
		rc_status -v
79
		exit 1
80
	fi
81
fi