#! /bin/bash
# ----------------------------------------------------------------------------
# /var/install/deinstall/libpcre-dev - deinstall script
#
# Creation   : 2010-09-17 alex
# Last update: $Id$
#
# Copyright (c) 2010 the eisfair team, team(at)eisfair(dot)org
#
# 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.
# ----------------------------------------------------------------------------

# include eislib
. /var/install/include/eislib

# Set package name
packageName=libpcre-dev

# Set filelist
filelist=/etc/filelist.d/${packageName}-files.txt

# Check if this is an update
if [ "${1}" == "update" ]
then
    mecho -info "Updating ${packageName} (removing previous version)"
    update=true
else
    mecho -info "Removing ${packageName}"
    update=false
fi

#----------------------------------------------------------------------------
# Remove package content
#----------------------------------------------------------------------------
while read id perm user group package file
do
    case ${id} in
        b|u)
            # remove program files
            if [ "${file}" != "tmp/install.sh" -a "${file}" != "tmp/preinstall.sh" ]
            then
                rm -f /${file}
            fi
        ;;

        f)
            # remove directories
            rmdir --ignore-fail-on-non-empty /${file}
        ;;
    esac
done < ${filelist}

rm -f /usr/lib/libpcre.so
rm -f /usr/lib/libpcrecpp.so
rm -f /usr/lib/libpcreposix.so

exit 0
#----------------------------------------------------------------------------
# End
#----------------------------------------------------------------------------
