#!/bin/bash -e
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
# Copyright 2011
# authors: Amalu Obinna <amaluobinna@aol.com>
#          Brady Miller <brady.g.miller@gmail.com>
#
# Un-install script steps:
#  1) Remove OpenEMR log directory
#
# summary of how this script can be called:
#        * <postrm> `remove'
#        * <postrm> `purge'
#        * <old-postrm> `upgrade' <new-version>
#        * <new-postrm> `failed-upgrade' <old-version>
#        * <new-postrm> `abort-install'
#        * <new-postrm> `abort-install' <old-version>
#        * <new-postrm> `abort-upgrade' <old-version>
#        * <disappearer's-postrm> `disappear' <overwriter>
#          <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
#

# Source debconf library.
. /usr/share/debconf/confmodule

#constants

LOGDIR=/var/log/openemr

case "$1" in
   remove)
      #remove log directory
      rm -rf $LOGDIR
      # Remove db prompt stuff.
      db_purge
      exit 0
   ;;

   purge)
      echo "postrm asked to do purge"
      exit 0
   ;;

   upgrade)
      #echo "No need for upgrade instructions in postrm script to version $2"
      exit 0
   ;;

   failed-upgrade)
      echo "postrm asked to do failed-upgrade from version $2"
      exit 0
   ;;

   abort-install)
      echo "postrm asked to do abort-install"
      exit 0
   ;;

   abort-upgrade)
      echo "postrm asked to do abort-upgrade from version $2"
      exit 0
   ;;


   disappear)
      echo "postrm asked to do disappear"
      exit 0
   ;;

   *)
      echo "postrm called with unknown argument \`$1'" >&2
      exit 1
   ;;
esac
