On Tue, Jan 21, 2014 at 10:48:20PM +0530, Hari Bathini wrote:
+ # Check if backup initrd is already present. If not, then
+ # this is the first time fadump is being used OR user
+ # has switched from kdump to fadump.
+ # Take a backup of the original default initrd before
+ # we rebuild default initrd for fadump support.
+ if [ ! -e $default_initrd_bak ];then
+ echo "Backing up default initrd"
+ cp $default_initrd $default_initrd_bak
I think this function should be named better. Say handle_dump_mode_switch().
In general there are too many checks for what state we are in, whether
we have transitioned modes (from fadump to kdump or vice versa).
I think we should write a top level function where we should do all
this processing, instead of it being sprinkled all over.
That is determine in what mode kdump service is supposed to start, kdump
or fadump and store that state in a variable, say "dump_mode". And use
that variable in rest of the places to take kdump or fadump specific
So your top level function could be say, determine_dump_mode(). And
with-in that function you could also handle mode transition and call
Once this is taken care of reading up rest of the code will become little