#!/bin/sh
#-----------------------------------------------------------------------
# /var/install/deinstall/gnupg -- gnupg deinstallation
#
# Copyright (c) 2005--2009 Alexander Dahl <post@lespocky.de>
#
# Creation:     2005-08-02  alex
# Last Update:  $Id: gnupg 382 2009-11-14 14:23:09Z alex $
#
# 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.
#-----------------------------------------------------------------------
PATH='/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin'

_PACKAGE_NAME='gnupg'

#-----------------------------------------------------------------------
# Include EisFair Lib if there and show a message
#-----------------------------------------------------------------------
if [ -f /var/install/include/eislib ]
then
    . /var/install/include/eislib
    #-------------------------------------------------------------------
    # New Script Message
    #-------------------------------------------------------------------
    mecho -info "Deinstalling ${_PACKAGE_NAME} ..."
else
    #-------------------------------------------------------------------
    # Old Script Message
    #-------------------------------------------------------------------
    echo "Deinstalling ${_PACKAGE_NAME} ..."
fi

# ----------------------------------------------------------------------
# remove all files from filelist
# ----------------------------------------------------------------------
for _filename in `grep -v ' tmp/' /etc/filelist.d/${_PACKAGE_NAME}-files.txt | awk '/^[u|b]/ {print "/"$6}'`
do
    rm -f ${_filename}
done

# ----------------------------------------------------------------------
# remove empty folders
# ----------------------------------------------------------------------
### documentation
rm -fr /usr/share/${_PACKAGE_NAME}
rm -fr /usr/local/${_PACKAGE_NAME}
rm -fr /usr/share/doc/${_PACKAGE_NAME}

echo 'Done.'

exit 0
