#!/bin/sh -x
INSTALLDIR=/usr/local
XTERM=`which xterm`
MANPATH=/usr/man

mkdir $INSTALLDIR
mkdir $INSTALLDIR/nxm
mkdir $MANPATH
mkdir $MANPATH/man1

cat << EOF >nxm.conf
#First file is service config file
$INSTALLDIR/nxm/services.conf

#Second file is used as the filter file
$INSTALLDIR/nxm/filter.conf

#Third file is used as the log-status init file
$INSTALLDIR/nxm/loginit.conf

#Fourth file is used to store the connection-filename pair
$INSTALLDIR/nxm/connname.txt

#Fifth program is used to execute as the term emulator,change it to your specified
$XTERM

#Sixth file is used to log the ICMP messages.
$INSTALLDIR/nxm/icmp.log
EOF

cp ./comm_tty $INSTALLDIR/nxm
cp ./loginit.conf $INSTALLDIR/nxm
cp ./filter.conf $INSTALLDIR/nxm
mv ./nxm.conf $INSTALLDIR/nxm
cp ./services.conf $INSTALLDIR/nxm
cp ./netxmon.1 $MANPATH/man1/
chmod a+r $MANPATH/man1/netxmon.1
chmod -R 600 $INSTALLDIR/nxm
chmod 700 $INSTALLDIR/nxm/comm_tty

