#!/bin/sh
#-----------------------------------------------------------------------
# /tmp/install.sh - libgcrypt11 installation
#
# Creation   : 2008-09-22 alex
# Last update: $Id: install.sh 252 2009-02-09 21:15:39Z 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.
#-----------------------------------------------------------------------

# Set packages name
packageName=libgcrypt11

# Don't change the name of the following variable! It is automatically 
# updated during the package build with mktarball
libVersion=11.5.2

libMajor=`echo ${libVersion} | cut -d. -f1`
libMinor=`echo ${libVersion} | cut -d. -f2`
libPatch=`echo ${libVersion} | cut -d. -f3`

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

mecho -info "installing ${packageName} ..."

#-----------------------------------------------------------------------
# generate symlinks
#-----------------------------------------------------------------------
cd /usr/lib/

rm -f libgcrypt.so.${libMajor}
ln -sf libgcrypt.so.${libVersion} libgcrypt.so.${libMajor}

cd - >/dev/null

#-----------------------------------------------------------------------
# running ldconfig
#-----------------------------------------------------------------------
/sbin/ldconfig >/dev/null 2>&1

#-----------------------------------------------------------------------
# generate deinstall file
#-----------------------------------------------------------------------

# check for date
packageDate=`grep "<date>" /var/install/packages/${packageName} | sed 's#</*date>##g'`

cat > /var/install/deinstall/${packageName} <<EOF
#! /bin/sh
#-----------------------------------------------------------------------
# /var/install/deinstall/${packageName} - ${packageName} deinstallation
#
# Creation:     2008-09-22 alex
# Last Update:  ${packageDate} alex
#
# Copyright (c) 2007 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.
#-----------------------------------------------------------------------

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

mecho -info " THIS PACKAGE IS PART OF THE SYSTEM!"
mecho -info " YOU CAN NOT REMOVE IT "

exit 1

EOF

chmod 0700 /var/install/deinstall/${packageName}
touch -r /var/install/packages/${packageName} /var/install/deinstall/${packageName}
echo "u 0700 root root ${packageName} var/install/deinstall/${packageName}" >>/etc/filelist.d/${packageName}-files.txt

#-----------------------------------------------------------------------
# check for old (devel-)packages
#-----------------------------------------------------------------------
version=`grep "<version" /var/install/packages/${packageName} | tr -d ' ' | sed 's#</*version>##g'`

packageName=libgcrypt11-dev

if [ -f /var/install/packages/${packageName} -a "`/var/install/bin/check-version ${packageName} ${version}`" == "new" ]
then
    mecho
    mecho -warn "An old devel package is installed."
    mecho -warn "To prevent version conflicts it is recommended that you also update"
    mecho -warn "the devel package. Look for the following name and version:"
    mecho -warn "Name: ${packageName}     Version: ${version}"
    mecho
    mecho -warn "You can download and install a new devel package over the standard"
    mecho -warn "list in your setup menu."
    mecho
    sleep 2
fi

exit 0

#-----------------------------------------------------------------------
# end
#-----------------------------------------------------------------------
