#!/bin/sh
# ----------------------------------------------------------------------------
# /var/install/deinstall/pkg-config - deinstall script
#
# Creation   : 2008-11-05 alex
# Last update: $Id: pkg-config 121 2008-11-06 07:49:01Z alex $
#
# Copyright (c) 2008 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 packages name
packageName=pkg-config

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

# check for update is given
if [ "${1}" == "update" ]
then
    mecho -info "updating ${packageName} (removing previous version)"
    update=1
else
    mecho -info "removing ${packageName}"
    update=0
fi
#----------------------------------------------------------------------------
# remove program files
#----------------------------------------------------------------------------

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}


exit 0
#----------------------------------------------------------------------------
# end
#----------------------------------------------------------------------------
