#! /bin/sh
#
# Copyright (c) 1997 Silicon Graphics, Inc.  All Rights Reserved.
# 
# 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; either version 2 of the License, or (at your
# option) any later 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.,
# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
# 
# Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
# Mountain View, CA 94043, USA, or: http://www.sgi.com
#
# Install the summary PMDA and/or PMNS
#
# $Id: Install,v 2.14 2000/12/28 07:37:59 max Exp $
#

# Get standard environment
. /etc/pcp.env

# Get the common procedures and variable assignments
#
. $PCP_SHARE_DIR/lib/pmdaproc.sh

# The name of the PMDA
#
iam=summary
pmda_interface=2

# Do it
#
pmdaSetup

if $do_pmda
then
    if [ ! -x $PCP_BIN_DIR/pmie ]
    then
	echo \
'Error: The "summary" PMDA requires the pmie(1) application but this
       does not appear to be installed.'
	if [ "$PCP_PLATFORM" = "irix" ] ; then
	    echo \
'       You should install the pcp_eoe.sw.monitor subsystem from the IRIX
       6.5 distribution (or the PCP distribution for earlier IRIXes) and
       the pcp.sw.monitor subsystem from the PCP distribution, then try
       to install the "summary" PMDA again.'
	fi
	exit 1
    fi

    while true
    do
	echo -n "Interval between summary expression evaluation (seconds)? [10] "
	read delta
	[ -z "$delta" ] && delta=10
	[ -z "`echo $delta | tr -d '[0-9]'`" ] && break
	echo "Error: interval \"$delta\" must be an integer, please try again"
    done
    args="$PCP_BIN_DIR/pmie -x -t $delta $PCP_PMDAS_DIR/summary/expr.pmie"
    check_delay=15
fi

pmdaInstall

exit 0
