#
# (c) Bernhard Walle <bwalle@suse.de>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; You may only use version 2 of the License, you have no option to
# use any other version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 675 Mass
# Ave, Cambridge, MA 02139, USA.
#

KDUMP_CONFIG=/etc/sysconfig/kdump

###############################################################################
# Sources the configuration file
function source_config
{
    if [ ! -r $KDUMP_CONFIG ] ;then
        echo "Kdump configuration file doesn't exist"
	return 1
    fi

    source $KDUMP_CONFIG

    return 0
}

###############################################################################
# Checks if the binary contains debug information
function contains_debuginfo()
{
    if [ ! -r "$1" ] ; then
        echo "contains_debuginfo: File doesn't exist"
        return 1
    fi

    if ! which readelf > /dev/null ; then
        echo "readelf doesn't exist, install binutils"
        return 1
    fi

    readelf -S "$1" |grep .debug_frame >/dev/null
}

###############################################################################
# Prints debugging output if KDUMP_VERBOSE & 8 is true.
function print_debug
{
    if [ $(($KDUMP_VERBOSE & 8)) -gt 0 ] ; then
        echo $*
    fi
}

# vim: set ft=sh sw=4 ts=4 et:
