#!/bin/sh


if [ "x$1" = "x" ]; then    
    echo "usage $0 <prefix>"
    exit
else    
    prefix=$1    
fi    

MIBMODULES=@@MIBMODULESDEF@@
MIBDIR=@@MIBSRC@@
 
if [ ! -d $prefix ]; then
    mkdir $prefix && echo "$prefix created"
fi

if [ -f $prefix/init.tcl ]; then
    echo "init.tcl already exists"
else
    echo "#Init.tcl generated for Covalent use" > $prefix/init.tcl
    echo "# Copyright (c) Covalent Technologies, 2000" >> $prefix/init.tcl
    for mibfile in $MIBMODULES ; do
        echo "mib load $prefix/mibs/$mibfile.txt" >> $prefix/init.tcl
    done
    echo "init.tcl generated"
fi
if [ -f $prefix/www_monitor.tcl ]; then    
    echo "www_monitor.tcl already exists" 
else    
    cp www_monitor.tcl $prefix/ && echo "www_monitor.tcl installed"
fi


if [ ! -d $prefix/mibs ]; then
    mkdir $prefix/mibs && echo "$prefix/mibs created"
fi
for mibfile in $MIBMODULES ; do
    if [ -f $MIBDIR/$mibfile.txt ]; then
        cp $MIBDIR/$mibfile.txt $prefix/ && echo "$mibfile installed"
    else
        echo "$mibfile could not be found"
    fi
done

