2011-08-01 09:19:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
check() {
|
|
|
|
[[ $debug ]] && set -x
|
|
|
|
#kdumpctl sets this explicitly
|
|
|
|
if [ -z "$IN_KDUMP" ] || [ ! -f /etc/kdump.conf ]
|
|
|
|
then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2011-08-02 06:00:50 +00:00
|
|
|
to_udev_name() {
|
2011-08-01 15:40:35 +00:00
|
|
|
local dev="$1"
|
|
|
|
|
|
|
|
case "$dev" in
|
|
|
|
UUID=*)
|
|
|
|
dev=`blkid -U "${dev#UUID=}"`
|
|
|
|
;;
|
|
|
|
LABEL=*)
|
|
|
|
dev=`blkid -L "${dev#LABEL=}"`
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo ${dev#/dev/}
|
|
|
|
}
|
|
|
|
|
2011-08-01 09:19:24 +00:00
|
|
|
depends() {
|
2011-12-16 06:21:02 +00:00
|
|
|
echo "base shutdown"
|
2011-08-01 09:19:24 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
install() {
|
2012-01-25 08:58:35 +00:00
|
|
|
sed -ne '/^#/!p' /etc/kdump.conf > /tmp/$$-kdump.conf
|
2011-08-01 16:33:14 +00:00
|
|
|
while read config_opt config_val;
|
|
|
|
do
|
|
|
|
case "$config_opt" in
|
|
|
|
ext[234]|xfs|btrfs|minix|raw)
|
2012-01-25 08:58:35 +00:00
|
|
|
sed -i -e "s#$1#/dev/$(to_udev_name $1)#" /tmp/$$-kdump.conf
|
2011-08-01 16:33:14 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < /etc/kdump.conf
|
|
|
|
|
2011-08-01 09:19:24 +00:00
|
|
|
inst "/bin/date" "/bin/date"
|
|
|
|
inst "/bin/sync" "/bin/sync"
|
|
|
|
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
|
2011-08-02 08:42:21 +00:00
|
|
|
inst "/tmp/$$-kdump.conf" "/etc/kdump.conf"
|
2011-12-16 06:21:02 +00:00
|
|
|
inst_hook pre-pivot 01 "$moddir/kdump.sh"
|
2011-08-01 09:19:24 +00:00
|
|
|
}
|
|
|
|
|