#! /bin/sh
#
# Install script for the ch_p4 device
# This script is called by mpiinstall to install the device.
# It should add commands to the file named by UNINSTALLFILE to remove
# any file that it adds.
if [ -z "$MAKE" -o -z "$XMODE" ] ; then
    echo "This script must be invoked from mpiinstall"
    exit 1
fi
if [ -f mpid/server/Makefile ] ; then
    export XMODE
    (cd mpid/server ; $MAKE install UNINSTALLFILE=$UNINSTALLFILE )
    rm -f ${bindir}/mpichboot
    cat >${bindir}/mpichboot <<EOF
#! /bin/sh
${bindir}/chp4_servs
EOF
    chmod $XMODE ${bindir}/mpichboot
    rm -f ${bindir}/mpichstop
    cat >${bindir}/mpichstop <<EOF
#! /bin/sh
${bindir}/chkserv -kill
EOF
    chmod $XMODE ${bindir}/mpichstop
else
    echo "Could not find Makefile for mpid/server!"
    echo "Install not completed"
    exit 1
fi
