Adding more helpers for mkdumprd2
This commit is contained in:
parent
bda545992e
commit
924a3c401f
28
kdump_build_helpers/generate_module_list
Executable file
28
kdump_build_helpers/generate_module_list
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
BASE_DIR=$1
|
||||
STAGE_DIR=$BASE_DIR/stage
|
||||
|
||||
#This build helper queries the currently loaded modules
|
||||
#copies them to the initrd, and builds the /etc/module_load_list file
|
||||
|
||||
mkdir -p $STAGE_DIR/modules
|
||||
|
||||
for i in `/sbin/lsmod | awk '{print $1}'`
|
||||
do
|
||||
for j in `/sbin/modprobe --show-depends $i | awk '/^insmod/ {print $2}'`
|
||||
do
|
||||
bname=$(basename $j)
|
||||
cp $j $STAGE_DIR/modules
|
||||
grep -q $bname $STAGE_DIR/modules 2>/dev/null
|
||||
|
||||
# Add the module to the list if its not already there
|
||||
# or if the list doesn't yet exist
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo /modules/$bname >> $STAGE_DIR/etc/module_load_list
|
||||
fi
|
||||
|
||||
done
|
||||
done
|
||||
|
24
kdump_runtime_helpers/assemble_lvm_array
Executable file
24
kdump_runtime_helpers/assemble_lvm_array
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/msh
|
||||
#kdump-requires: /etc/lvm/lvm.conf
|
||||
#
|
||||
echo "Scanning logical volumes"
|
||||
lvm vgscan --ignorelockingfailure --mknodes
|
||||
echo "Activating logical volumes"
|
||||
lvm vgchange -a y --ignorelockingfailure
|
||||
DM_NUM=0
|
||||
for i in `lvm lvs --noheadings -o lv_name,vg_name | sed -e's/\+/:/g'`
|
||||
do
|
||||
LV=`echo \$i | awk -F":" '{ print $2 }'`
|
||||
VGRP=`echo $i | awk -F":" '{ print $3 }'`
|
||||
mkdir -p /dev/$VGRP
|
||||
if [ ! -e /dev/$VGRP/$LV ]
|
||||
then
|
||||
ln -s /dev/mapper/$VGRP-$LV /dev/$VGRP/$LV
|
||||
DM_NUM=`echo $DM_NUM 1 + p | dc`
|
||||
echo "Resuming /dev/mapper/"$VGRP-$LV
|
||||
/sbin/dmsetup resume /dev/mapper/$VGRP-$LV
|
||||
fi
|
||||
|
||||
done
|
||||
echo "All LVM volumes reactivated"
|
||||
exit 0
|
11
kdump_runtime_helpers/load_modules
Executable file
11
kdump_runtime_helpers/load_modules
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/msh
|
||||
#kdump-requires: /etc/module_load_list
|
||||
|
||||
echo "Loading modules"
|
||||
|
||||
while read module opts
|
||||
do
|
||||
echo "Loading module" $module
|
||||
insmod $module $opts
|
||||
done < /etc/module_load_list
|
||||
echo "Done loading modules"
|
36
kdump_runtime_helpers/wait_for_critical_disks
Executable file
36
kdump_runtime_helpers/wait_for_critical_disks
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/msh
|
||||
#kdump-requires: /etc/critical-disks
|
||||
|
||||
echo "Waiting for critical disks"
|
||||
|
||||
TIMEOUT_COUNT=""
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
TIMEOUT_COUNT=$1
|
||||
fi
|
||||
|
||||
let COUNT=0
|
||||
|
||||
for i in `cat /etc/critical_disks`
|
||||
do
|
||||
echo -n "Waiting for" $i "..."
|
||||
while [ ! -d $i ]
|
||||
do
|
||||
sleep 1
|
||||
if [ -n "$TIMEOUT_COUNT" ]
|
||||
then
|
||||
if [ "$TIMEOUT_COUNT" == "$COUNT" ]
|
||||
then
|
||||
echo "Timeout waiting for disks, continuing..."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
let COUNT=$COUNT+1
|
||||
done
|
||||
echo "Found" $i
|
||||
done
|
||||
|
||||
echo "Found all disks"
|
||||
exit 0
|
||||
|
@ -323,7 +323,10 @@ create_initramfs_image()
|
||||
then
|
||||
finish_and_exit 1 " Could not create initramfs"
|
||||
fi
|
||||
target=NEED TO PASS IN TARGET KERNEL HERE
|
||||
|
||||
# Get running kernel version to name the initramfs with
|
||||
target=$(uname -r)
|
||||
gzip -9 -c $IMG_FILE > initrd-$target.img
|
||||
}
|
||||
|
||||
|
||||
@ -331,6 +334,8 @@ create_initramfs_image()
|
||||
#Start the actual code here
|
||||
##########################################################
|
||||
|
||||
# Get our passed in options
|
||||
|
||||
# Create a new staging area
|
||||
create_new_initramfs_dir
|
||||
if [ $? != 0 ]
|
||||
|
Loading…
Reference in New Issue
Block a user