4
# Required-Start: $local_fs
5
# Required-Stop: $local_fs
6
# Default-Start: 1 2 3 4 5
8
# Short-Description: Configure s390 dump feature
9
# Description: Configures the s390 dump feature. It uses the configuration file
10
# /etc/sysconfig/dumpconf
13
# chkconfig: 12345 01 99
15
DUMP_CONFIG_FILE=/etc/sysconfig/dumpconf
21
if [ ! -f $DUMP_CONFIG_FILE ]; then
22
echo "no config file found: $DUMP_CONFIG_FILE"
26
if [ "$(cat /proc/filesystems|grep sysfs)" = "" ]; then
27
echo "no sysfs found" >&2
31
SYSFSDIR=$(cat /proc/mounts|awk '$3=="sysfs"{print $2; exit}')
32
if [ "$SYSFSDIR" = "" ]; then
33
echo "sysfs not mounted" >&2
37
DUMP_CONFIG_DIR=/$SYSFSDIR/firmware/dump
38
ON_PANIC_CONFIG_FILE=/$SYSFSDIR/firmware/shutdown_act\
41
if [ ! -d $DUMP_CONFIG_DIR ]; then
42
echo "kernel has no dump on panic support"
51
Usage: dumpconf [OPTIONS]
53
This script can be used to configure the dump device which is used by the
54
Linux kernel in case of a kernel panic.
56
It uses the configuration file /etc/sysconfig/dumpconf as input.
60
-h, --help print this help
61
-v, --version print version information
62
start enable configuration defined in /etc/sysconfig/dumpconf
63
stop disable dump on panic
64
status show current dump on panic configuration
71
dumpconf: zSeries dump configuration script version 1.0.
72
Copyright IBM Corp. 2006.
76
print_invalid_option()
79
dumpconf: invalid option -- $1
80
Try 'dumpconf --help' for more information.
85
DUMP_TYPE_CHECK=$(cat $DUMP_CONFIG_DIR/dump_type)
86
ON_PANIC_CHECK=$(cat $ON_PANIC_CONFIG_FILE)
87
if [ "$ON_PANIC_CHECK" == "dump" -a "$DUMP_TYPE_CHECK" == "none" ]; then
88
echo "WARNING: on_panic is set to dump, but no dump configuration exists." >&2
89
echo " Are you sure, that this is really what you want?" >&2
93
# $1: dump device bus id (e.g. 0.0.4711)
94
verify_ccw_dump_device()
97
if [ "$line" == "" ]; then
98
echo "WARNING: device $1 not found!"
104
if [ $found == true ]; then
107
if [ "$i" == "is" ]; then
111
zgetdump -d /dev/$i > /dev/null 2>&1
115
echo "WARNING: $1 is no valid dump device!"
124
ERRMSG="Dump configuration failed!"
125
if [ "$DUMP_TYPE" == "" ]; then
126
echo none > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
127
elif [ "$DUMP_TYPE" == "none" ]; then
128
echo none > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
129
elif [ ! -d $DUMP_CONFIG_DIR/$DUMP_TYPE ]; then
130
ERRMSG="dumptype '$DUMP_TYPE' not supported on this machine!"
132
elif [ "$DUMP_TYPE" == "ccw" ]; then
133
echo $DEVICE > $DUMP_CONFIG_DIR/ccw/device || RETVAL=1
134
echo ccw > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
135
elif [ "$DUMP_TYPE" == "fcp" ]; then
136
echo $DEVICE > $DUMP_CONFIG_DIR/fcp/device || RETVAL=1
137
echo $WWPN > $DUMP_CONFIG_DIR/fcp/wwpn || RETVAL=1
138
echo $LUN > $DUMP_CONFIG_DIR/fcp/lun || RETVAL=1
139
echo $BOOTPROG > $DUMP_CONFIG_DIR/fcp/bootprog || RETVAL=1
140
echo $BR_LBA > $DUMP_CONFIG_DIR/fcp/br_lba || RETVAL=1
141
echo fcp > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
146
if [ $RETVAL -eq 1 ]; then
147
echo none > $DUMP_CONFIG_DIR/dump_type
148
echo stop > $ON_PANIC_CONFIG_FILE
149
echo "ERROR: $ERRMSG Check $DUMP_CONFIG_FILE!" >&2
155
CONF_DUMP_TYPE=$(cat $DUMP_CONFIG_DIR/dump_type)
157
if [ "$CONF_DUMP_TYPE" == "none" ]; then
158
echo -n "No dump device configured. "
160
echo -n "$CONF_DUMP_TYPE dump device configured. "
165
if [ "$ON_PANIC" == "" ]; then
168
echo $ON_PANIC > $ON_PANIC_CONFIG_FILE || RETVAL=1
169
if [ $RETVAL -eq 1 ]; then
170
echo stop > $ON_PANIC_CONFIG_FILE
172
echo "ERROR: Invalid setting for on_panic '$ON_PANIC'! Please check $DUMP_CONFIG_FILE!" >&2
176
echo "\"$ON_PANIC\" on panic configured."
185
echo none > $DUMP_CONFIG_DIR/dump_type || RETVAL=1
186
echo stop > $ON_PANIC_CONFIG_FILE || RETVAL=1
187
if [ $RETVAL -eq 0 ]; then
188
echo "Dump on panic is disabled now"
190
echo "Disabling dump on panic failed" >&2
197
CONF_DUMP_TYPE=$(cat $DUMP_CONFIG_DIR/dump_type) || RETVAL=1
198
if [ "$CONF_DUMP_TYPE" == "none" ]; then
199
echo "type....: no dump device configured"
200
elif [ "$CONF_DUMP_TYPE" == "ccw" ]; then
201
echo "type....: $(cat $DUMP_CONFIG_DIR/dump_type)" || RETVAL=1
202
device=$(cat $DUMP_CONFIG_DIR/ccw/device)
203
echo "device..: $device" || RETVAL=1
204
elif [ "$CONF_DUMP_TYPE" == "fcp" ]; then
205
echo "type....: $(cat $DUMP_CONFIG_DIR/dump_type)" || RETVAL=1
206
echo "device..: $(cat $DUMP_CONFIG_DIR/fcp/device)" || RETVAL=1
207
echo "wwpn....: $(cat $DUMP_CONFIG_DIR/fcp/wwpn)" || RETVAL=1
208
echo "lun.....: $(cat $DUMP_CONFIG_DIR/fcp/lun)" || RETVAL=1
209
echo "bootprog: $(cat $DUMP_CONFIG_DIR/fcp/bootprog)" || RETVAL=1
210
echo "br_lba..: $(cat $DUMP_CONFIG_DIR/fcp/br_lba)" || RETVAL=1
212
echo "ERROR: Unknown dump device type '$TYPE'!" >&2
213
echo " Please check if you have the latest dumpconf package!" >&2
216
ON_PANIC=$(cat $ON_PANIC_CONFIG_FILE) || RETVAL=1
217
echo "on_panic: $ON_PANIC"
218
if [ "$CONF_DUMP_TYPE" == "ccw" ]; then
219
verify_ccw_dump_device $device
224
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
227
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
234
# See how we were called.
236
start|restart|reload|force-reload|try-restart)
246
print_invalid_option $1