#
# snaulmod
#
# Remove all the SNAP-IX loadable modules
# (ALL calling scripts should ensure sna stopped first)

# 
# Set path for message catalog file.  Set "C" to be the default.
NLSPATH=/opt/ibm/sna/lib/nls/msg/LC_MESSAGES/%N:/opt/ibm/sna/lib/nls/msg/%L/%N
export NLSPATH=${NLSPATH}:/opt/ibm/sna/lib/nls/msg/C/%N

#
# Set path for snareadinstcat binary
READINSTCAT=/opt/ibm/sna/bin/snareadinstcat

#
#  Check that CS Linux daemon/appl is not running
#
ACTIVE=`ps -ef | egrep "snadaemon" | grep -v grep`
if [ "x$ACTIVE" != "x" ]
then
  # echo "Error: SNA must be stopped before running this script"
  $READINSTCAT 18
  exit 10
fi
#

# -s directs output to the syslog
cat /proc/modules | grep sna_linux > /dev/null 2>&1
if [ $? = 0 ]
then
  /sbin/rmmod -s streams-sixc
  /sbin/rmmod -s streams-sixi
  /sbin/rmmod -s streams-sixy
  /sbin/rmmod -s streams-sixn
  /sbin/rmmod -s streams-sixr
  /sbin/rmmod -s sna_trace
  /sbin/rmmod -s sna_linux
fi
#
# Delete the sna device entries
#
rm -f /dev/sna_* 2> /dev/null
