#! /bin/sh -c "echo This script should not be run directly.; exit 1"

gm_service=gm

gm_start_gm ()
{
    # Return successfully if GM has been uninstalled, as required by
    # Debian policy.

    if test ! -f "${prefix}/bin/gm_board_info"
    then
	gm_echo "GM has been uninstalled."
	return 0
    fi
    
    # If we can run gm_board_info, then an old version of the
    # driver is running, and we cannot start GM.
    gm_do "${prefix}/bin/gm_board_info" > /dev/null 2>&1 \
    && gm_die GM must be stopped first.
    
    gm_arch_start_gm || return $?

    # Make sure that the driver actually initialized an interface by
    # running gm_board_info
    gm_wait_for_driver_to_load
    
    return 0
}

gm_stop_gm ()
{
    # Return successfully if GM has been uninstalled, as required by
    # Debian policy.

    if test ! -f "${prefix}/bin/gm_board_info"
    then
	gm_echo "GM has been uninstalled."
	return 0
    fi
    
    gm_arch_stop_gm || return $?

    # If we can still run gm_board_info, then we failed to unload the
    # driver.
    gm_do "${prefix}/bin/gm_board_info" > /dev/null 2>&1 \
    && return 1

    return 0
}

# chkconfig: 2345 20 80
# description: Provides GM API support and ethernet emulation for \
#              Myrinet network interface cards.
