8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00
firebird-mirror/builds/install/arch-specific/linux/classic/postuninstall.sh.in
2003-07-08 22:59:57 +00:00

124 lines
3.3 KiB
Bash

#!/bin/sh
#
# This library is part of the FirebirdSQL project
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# You may obtain a copy of the Licence at
# http://www.gnu.org/licences/lgpl.html
#
# As a special exception this file can also be included in modules
# with other source code as long as that source code has been
# released under an Open Source Initiative certificed licence.
# More information about OSI certification can be found at:
# http://www.opensource.org
#
# This module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public Licence for more details.
#
# This module was created by members of the firebird development
# team. All individual contributions remain the Copyright (C) of
# those individuals and all rights are reserved. Contributors to
# this file are either listed below or can be obtained from a CVS
# history command.
#
# Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au>
#
# Contributor(s):
#
#
# $Id: postuninstall.sh.in,v 1.1 2003-07-08 22:59:57 brodsom Exp $
#
# The post uninstall routine for Firebird Classic.
#------------------------------------------------------------------------
# remove line from config file if it exists in it.
removeLineFromFile() {
FileName=$1
oldLine=$2
if [ ! -z "$oldLine" ]
then
cat $FileName | grep -v "$oldLine" > ${FileName}.tmp
mv ${FileName}.tmp $FileName
echo "Updated."
fi
}
#------------------------------------------------------------------------
# remove the xinetd config file and restart the service
removeXInetDService() {
if [ -f /etc/xinetd.d/firebird ]
then
rm -f /etc/xinetd.d/firebird
fi
if [ -f /var/run/xinetd.pid ]
then
kill -USR2 `cat /var/run/xinetd.pid`
fi
}
#------------------------------------------------------------------------
# remove the inetd file and restart the service.
removeInetDService() {
# Next, lose the gds_db line from /etc/inetd.conf
FileName=/etc/inetd.conf
oldLine=`grep "^gds_db" $FileName`
removeLineFromFile "$FileName" "$oldLine"
# Get inetd to reread new inetd.conf file
if [ -f /var/run/inetd.pid ]
then
kill -HUP `cat /var/run/inetd.pid`
fi
}
#= Main PostUn ============================================================
# I don't think this is needed anymore.
# if [ -L /usr/lib/libgds.so ]
# then
# rm /usr/lib/libgds.so
# fi
if [ "$1"=0 ]
then
# Lose the gds_db line from /etc/services
# Leave it there, it was probably there already and does no
# harm. MOD 7-Nov-2002
#FileName=/etc/services
#oldLine=`grep "^gds_db" $FileName`
#removeLineFromFile "$FileName" "$oldLine"
if [ -d /etc/xinetd.d ]
then
removeXInetDService
elif [ -f /etc/inetd.d ]
then
removeInetDService
fi
fi