#!/bin/bash

#    R e m o v e    O L D    S t r u c t u r e    I f   T h e r e

BINDIR=/opt/hp/collectl

if [ -e $BINDIR ]; then

  # just uninstall utilities leaving collectl alone. 
  # if only utilities you much manually remove /opt/hp/collectl/*
  cd $BINDIR/docs
  rm -f RELEASE-colplot RELEASE-colgui RELEASE-colmux RELEASE-collectl-utils
  rm -f INSTALL-colplot README FAQ-colplot.html FAQ-colgui.html colplot-help.html

  cd $BINDIR/sbin
  rm -f colplot.pl colplot.conf colgui.pl colmux.pl

  cd $BINDIR/man1
  rm -f colplot* colmux* colgui*

  rm -f $BINDIR/etc/colplot-apache.conf

  # only utilities use these
  rm -fr $BINDIR/lib
  rm -fr $BINDIR/plotfiles
fi

#    N e w    D i r e c t o r y    S t r u c t u r e

BINDIR=/usr/bin
DOCDIR=/usr/share/doc/collectl
SHRDIR=/usr/share/collectl

rm -f  $BINDIR/colplot
rm -f  $BINDIR/colmux
rm -f  $BINDIR/colgui
rm -f  $SHRDIR/colplotlib.defs
rm -f  $SHRDIR/colplotlib.ph
rm -f  $SHRDIR/tiny.ph
rm -f  $SHRDIR/oneperpage.ph
rm -fr $SHRDIR/plotfiles
rm -fr $DOCDIR

rm -f /usr/share/man/man1/colplot.1.gz
rm -f /usr/share/man/man1/colgui.1.gz
rm -f /usr/share/man/man1/colmux.1.gz

#    C l e a n    U p    W e b    S t r u c t u r e

rm -fr /var/www/colplot           # debian
rm -fr /var/www/html/colplot      # redhat
rm -fr /srv/www/htdocs/colplot    # SuSE

rm -f /etc/apache2/sites-enabled/100-colplot
rm -f /etc/apache2/sites-available/colplot-apache.conf
