#!/bin/sh -c "echo This script should not be run directly.; exit 1"
################################################################
# Myricom GM networking software and documentation
# Copyright 2001, 2002 by Myricom, Inc.
# All rights reserved.   See the file `COPYING' for copyright notice.
################################################################
# author: glenn@myri.com
# $Source: /repository/gm/drivers/osf1/gm_arch_install,v $
################################################################
# Required entry points
################################################################

# Make sure we find the right tools on this machine, regardless of
# the user's path.
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin
export PATH

gm_arch_driver_start_command="/sbin/init.d/gm start"
gm_arch_install_program="/bin/installbsd"
gm_arch_install_args="-c"
gm_osf1_version_checked=0
gm_debug_arch_stop_gm=0


gm_arch_stop_ethernet ()
{
    for i in 0 1 2 3
    do
	gm_do /sbin/ifconfig myri${i} down > /dev/null 2>&1
	gm_do /sbin/ifconfig myri${i} delete > /dev/null 2>&1
	gm_do /sbin/ifconfig myri${i} abort > /dev/null 2>&1
    done
}

gm_arch_start_ethernet ()
{
    true
}

gm_arch_stop_gm ()
{
    gm_arch_stop_ethernet
    gm_do /sbin/sysconfig -u gm
}

gm_arch_start_gm ()
{
    gm_osf1_check_version \
    && gm_do sync \
    && gm_do sync \
    && gm_do sync \
    && gm_do sysconfig -c gm \
    && gm_do chmod 600 /dev/gmp*
}

gm_arch_install_ethernet ()
{
    true
#    gm_cp ${prefix}/etc/init.d/myri /usr/local/etc/rc.d/myri \
#    && gm_do sync \
#    && gm_log_uninstall_command "/usr/local/etc/rc.d/myri.sh stop" \
#    && gm_do /usr/local/etc/rc.d/myri start
}

gm_arch_install_gm ()
{
    gm_osf1_check_version \
    && (gm_do rm -f /usr/sys/BINARY/gm.mod \
		   /sys/BINARY/gm.mod     \
		   /var/subsys/gm.mod     \
		   /var/subsys/gm.mth     \
       || true) \
    && (gm_do /sbin/init.d/autosysconfig delete gm > /dev/null 2>&1 || true)\
    && (gm_do /sbin/sysconfigdb -d gm > /dev/null 2>&1 || true ) \
    && gm_cp ${prefix}/sbin/gm.mod /sys/BINARY/gm.mod \
    && gm_do ln -s /sys/BINARY/gm.mod /var/subsys/gm.mod \
    && gm_do ln -s /subsys/device.mth /var/subsys/gm.mth \
    && gm_do /sbin/sysconfigdb -a -f ${prefix}/etc/gm/sysconfigtab gm \
    && gm_cp ${prefix}/etc/init.d/gm /sbin/init.d/gm \
    && gm_do sync \
    && gm_do sync \
    && gm_do sync \
    && gm_log_uninstall_command "/sbin/init.d/gm stop" 
}

################################################################
# Osf1-specific functions
################################################################

gm_osf1_check_version ()
{
    if test $gm_osf1_version_checked != 0
    then
	return 0
    fi

    version=`uname -r`
    case "$version" in
    [123].* )
	gm_echo OSF1-"$version" is not supported by this release.
	return 1
	;;
    esac
    gm_osf1_version_checked=1
    return 0
}


