8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 19:23:03 +01:00

Changes to linux classic package/install

This commit is contained in:
skywalker 2002-11-11 05:56:38 +00:00
parent a38be7075d
commit 7d4488df4d
12 changed files with 2179 additions and 0 deletions

View File

@ -0,0 +1,151 @@
#!/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: install.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
#
# Script to install files from the build/transport area
# A little bit of tidying up of some odd files not in the original build
# These files will exist in the CVS tree.
# If this is a tar.gz install rather than the result of a build then
# We assume the files have already been copied here manually.
if [ -z "$FirebirdInstallPrefix" ]
then
FirebirdInstallPrefix=@prefix@
fi
if [ -z "$FirebirdBuildPrefix" ]
then
FirebirdBuildPrefix="."
fi
BuildDir=$FirebirdBuildPrefix/firebird
DestDir=$FirebirdInstallPrefix
# I think this is done as part of the build now.
# if [ -z "$InteractiveInstall" ]
# then
# ScriptsSrcDir=src/install/linux
# cp $ScriptsSrcDir/misc/README $BuildDir
# fi
# The guts of the tranfer of files to /opt and other directories
if [ -d $DestDir ]
then
rm -rf $DestDir
fi
mkdir $DestDir
mkdir $DestDir/bin
mkdir $DestDir/examples
mkdir $DestDir/help
mkdir $DestDir/include
mkdir $DestDir/intl
mkdir $DestDir/lib
mkdir $DestDir/doc
mkdir $DestDir/UDF
mkdir $DestDir/misc
cp -f $BuildDir/bin/fb_inet_server $DestDir/bin/fb_inet_server
cp $BuildDir/bin/gbak $DestDir/bin/gbak
cp $BuildDir/bin/gdef $DestDir/bin/gdef
cp $BuildDir/bin/gds_lock_print $DestDir/bin/gds_lock_print
cp $BuildDir/bin/gds_drop $DestDir/bin/gds_drop
cp $BuildDir/bin/gds_lock_mgr $DestDir/bin/gds_lock_mgr
cp $BuildDir/bin/gds_pipe $DestDir/bin/gds_pipe
cp $BuildDir/bin/gfix $DestDir/bin/gfix
cp $BuildDir/bin/gpre $DestDir/bin/gpre
cp $BuildDir/bin/gsec $DestDir/bin/gsec
cp $BuildDir/bin/gsplit $DestDir/bin/gsplit
cp $BuildDir/bin/gstat $DestDir/bin/gstat
cp $BuildDir/bin/isc4.gbak $DestDir/bin/isc4.gbak
cp $BuildDir/bin/isql $DestDir/bin/isql
cp $BuildDir/bin/qli $DestDir/bin/qli
cp $BuildDir/bin/CSchangeRunUser.sh $DestDir/bin
cp $BuildDir/bin/CSrestoreRootRunUser.sh $DestDir/bin
cp $BuildDir/bin/changeDBAPassword.sh $DestDir/bin
cp $BuildDir/examples/v5/*.[ceh] $DestDir/examples
cp $BuildDir/examples/v5/*.sql $DestDir/examples
cp $BuildDir/examples/v5/*.gbk $DestDir/examples
cp $BuildDir/examples/v5/*.gdb $DestDir/examples
cp $BuildDir/examples/v5/makefile $DestDir/examples
cp $BuildDir/help/help.gbak $DestDir/help
cp $BuildDir/help/help.gdb $DestDir/help
#cp -r $BuildDir/doc $DestDir
cp $BuildDir/firebird.msg $DestDir/firebird.msg
cp $BuildDir/isc4.gdb $DestDir/isc4.gdb
#cp $BuildDir/isc_config $DestDir/isc_config
cp -f $BuildDir/include/gds.h /usr/include/gds.h
cp -f $BuildDir/include/iberror.h /usr/include/iberror.h
cp -f $BuildDir/include/ibase.h /usr/include/ibase.h
cp -f $BuildDir/include/ib_util.h /usr/include/ib_util.h
cp -f $BuildDir/misc/firebird.conf /etc/firebird.conf
# cp $BuildDir/include/gds.f $DestDir/include
# cp $BuildDir/include/gds.hxx $DestDir/include
cp $BuildDir/include/*.h $DestDir/include
cp -f $BuildDir/lib/@FIREBIRD_LIBGDS_SO@ /usr/lib/@FIREBIRD_LIBGDS_SO@
if [ -L /usr/lib/@FIREBIRD_LIBGDS_SO_LNK@ ]
then
rm -f /usr/lib/@FIREBIRD_LIBGDS_SO_LNK@
fi
ln -s @FIREBIRD_LIBGDS_SO@ /usr/lib/@FIREBIRD_LIBGDS_SO_LNK@
if [ -L /usr/lib/@FIREBIRD_LIBGDS_SO_X_LNK@ ]
then
rm -f /usr/lib/@FIREBIRD_LIBGDS_SO_X_LNK@
fi
ln -s @FIREBIRD_LIBGDS_SO@ /usr/lib/@FIREBIRD_LIBGDS_SO_X_LNK@
# cp -f $BuildDir/lib/gds.a /usr/lib/libgds.a
cp -f $BuildDir/lib/ib_util.so /usr/lib/libib_util.so
cp $BuildDir/intl/libfbintl.so $DestDir/intl/fbintl
cp $BuildDir/UDF/ib_udf.so $DestDir/UDF/
# cp $BuildDir/README $DestDir/README
cp $BuildDir/misc/firebird.xinetd $DestDir/misc/firebird.xinetd

View File

@ -0,0 +1,179 @@
#! /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: makeInstallImage.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# Script to copy install files from the build/transport area
BuildSrcDir=firebird/install/linux
BuildDir=./firebird
TargetDir=buildroot
RealRootDir=@prefix@
FBRootDir=${RealRootDir#/} # strip off leading /
DestDir=$TargetDir/$FBRootDir
#------------------------------------------------------------------------
# copyFiles
# This function copies all the files for a classic distribution into a
# directory heirachy mirroring the installation.
copyFiles() {
# The guts of the tranfer of files and other directories
if [ -d $TargetDir ]
then
rm -fr $TargetDir
fi
mkdir -p $DestDir
mkdir $DestDir/bin
mkdir $DestDir/examples
mkdir $DestDir/help
mkdir $DestDir/include
mkdir $DestDir/intl
mkdir $DestDir/lib
mkdir $DestDir/doc
mkdir $DestDir/UDF
mkdir $DestDir/misc
mkdir $TargetDir/etc
# mkdir $TargetDir/etc/init.d
# mkdir $TargetDir/var
# mkdir $TargetDir/var/adm
# mkdir $TargetDir/var/adm/fillup-templates
# mkdir -p $TargetDir/usr/sbin
mkdir -p $TargetDir/usr/lib
mkdir -p $TargetDir/usr/include
cp -f $BuildDir/bin/fb_inet_server $DestDir/bin/fb_inet_server
cp $BuildDir/bin/gbak $DestDir/bin/gbak
cp $BuildDir/bin/gdef $DestDir/bin/gdef
cp $BuildDir/bin/gds_lock_print $DestDir/bin/gds_lock_print
cp $BuildDir/bin/gds_drop $DestDir/bin/gds_drop
cp $BuildDir/bin/fb_lock_mgr $DestDir/bin/fb_lock_mgr
cp $BuildDir/bin/gds_pipe $DestDir/bin/gds_pipe
cp $BuildDir/bin/gfix $DestDir/bin/gfix
cp $BuildDir/bin/gpre $DestDir/bin/gpre
cp $BuildDir/bin/gsec $DestDir/bin/gsec
cp $BuildDir/bin/gsplit $DestDir/bin/gsplit
cp $BuildDir/bin/gstat $DestDir/bin/gstat
cp $BuildDir/bin/isc4.gbak $DestDir/bin/isc4.gbak
cp $BuildDir/bin/isql $DestDir/bin/isql
cp $BuildDir/bin/qli $DestDir/bin/qli
cp $BuildDir/bin/CSchangeRunUser.sh $DestDir/bin
cp $BuildDir/bin/CSrestoreRootRunUser.sh $DestDir/bin
cp $BuildDir/bin/changeDBAPassword.sh $DestDir/bin
cp $BuildDir/examples/v5/*.[ceh] $DestDir/examples
cp $BuildDir/examples/v5/*.sql $DestDir/examples
cp $BuildDir/examples/v5/*.gbk $DestDir/examples
cp $BuildDir/examples/v5/*.gdb $DestDir/examples
cp $BuildDir/examples/v5/makefile $DestDir/examples
cp $BuildDir/help/help.gbak $DestDir/help
cp $BuildDir/help/help.gdb $DestDir/help
#cp -r $BuildSrcDir/doc $DestDir
#cp -r $BuildDir/doc $DestDir
cp $BuildDir/firebird.msg $DestDir/firebird.msg
cp $BuildDir/isc4.gdb $DestDir/isc4.gdb
# cp $BuildDir/include/gds.f $DestDir/include
# cp $BuildDir/include/gds.hxx $DestDir/include
cp $BuildDir/include/*.h $DestDir/include
cp -f $BuildDir/lib/@FIREBIRD_LIBGDS_SO@ $DestDir/lib/@FIREBIRD_LIBGDS_SO@
ln -s @FIREBIRD_LIBGDS_SO@ $DestDir/lib/@FIREBIRD_LIBGDS_SO_LNK@
ln -s @FIREBIRD_LIBGDS_SO@ $DestDir/lib/@FIREBIRD_LIBGDS_SO_X_LNK@
# cp -f $BuildDir/lib/gds.a /usr/lib/libgds.a
cp -f $BuildDir/lib/ib_util.so $DestDir/lib/libib_util.so
cp $BuildDir/intl/libfbintl.so $DestDir/intl/fbintl
cp $BuildDir/UDF/ib_udf.so $DestDir/UDF/
cp $BuildDir/UDF/fb_udf.so $DestDir/UDF/
# cp $BuildDir/README $DestDir/README
cp $BuildDir/misc/firebird.xinetd $DestDir/misc/firebird.xinetd
cp $BuildDir/misc/firebird.conf $DestDir/misc/firebird.conf
# Create links from /usr/lib to install area.
ln -s ../../$FBRootDir/lib/@FIREBIRD_LIBGDS_SO@ $TargetDir/usr/lib/@FIREBIRD_LIBGDS_SO@
ln -s ../../$FBRootDir/lib/@FIREBIRD_LIBGDS_SO_LNK@ $TargetDir/usr/lib/@FIREBIRD_LIBGDS_SO_LNK@
ln -s ../../$FBRootDir/lib/@FIREBIRD_LIBGDS_SO_X_LNK@ $TargetDir/usr/lib/@FIREBIRD_LIBGDS_SO_X_LNK@
ln -s ../../$FBRootDir/lib/libgds.a $TargetDir/usr/lib/libgds.a
ln -s ../../$FBRootDir/lib/libib_util.so $TargetDir/usr/lib/libib_util.so
# These two links are required for compatibility with existing ib programs
# If the program had been linked with libgds.so then this link is required
# to ensure it loads the fb equivalent. Eventually these should be
# optional and in a seperate rpm install. MOD 7-Nov-2002.
ln -s ../../$FBRootDir/lib/@FIREBIRD_LIBGDS_SO@ $TargetDir/usr/lib/libgds.so
ln -s ../../$FBRootDir/lib/@FIREBIRD_LIBGDS_SO_X_LNK@ $TargetDir/usr/lib/libgds.so.1
# link include files to /usr/include
for i in gds.h iberror.h ibase.h ib_util.h
do
ln -s ../../$FBRootDir/include/$i $TargetDir/usr/include/$i
done
(cd $DestDir; touch firebird.log;)
# chmod u=rw,go= firebird.log)
# (cd $DestDir; chmod uga+rw examples/*.gdb)
# chown -R root:root $TargetDir
}
#=== MAIN ====================================================================
copyFiles

View File

@ -0,0 +1,682 @@
#!/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: postinstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# The post install script for Firebird Classic
#------------------------------------------------------------------------
# Prompt for response, store result in Answer
Answer=""
AskQuestion() {
Test=$1
DefaultAns=$2
echo -n "${1}"
Answer="$DefaultAns"
read Answer
}
#------------------------------------------------------------------------
# add a service line in the (usually) /etc/services or /etc/inetd.conf file
# Here there are three cases, not found => add service line,
# found & different => ask user to check
# found & same => do nothing
#
replaceLineInFile() {
FileName=$1
newLine=$2
oldLine=$3
if [ -z "$oldLine" ]
then
echo "$newLine" >> $FileName
elif [ "$oldLine" != "$newLine" ]
then
echo ""
echo "--- Warning ----------------------------------------------"
echo ""
echo " In file $FileName found line: "
echo " $oldLine"
echo " Which differs from the expected line:"
echo " $newLine"
echo ""
# AskQuestion "Press return to update file or ^C to abort install"
cat $FileName | grep -v "$oldLine" > ${FileName}.tmp
mv ${FileName}.tmp $FileName
echo "$newLine" >> $FileName
echo "Updated."
fi
}
#------------------------------------------------------------------------
# Add new user and group
addFirebirdUser() {
testStr=`grep firebird /etc/group`
if [ -z "$testStr" ]
then
groupadd -g 84 -o -r firebird
fi
testStr=`grep firebird /etc/passwd`
if [ -z "$testDir" ]
then
useradd -o -r -m -d $FBRootDir -s /bin/bash \
-c "Firebird Database Administrator" -g firebird -u 84 firebird
# >/dev/null 2>&1
fi
}
#------------------------------------------------------------------------
# Delete new user and group
deleteFirebirdUser() {
userdel firebird
# groupdel firebird
}
#------------------------------------------------------------------------
# changeXinetdServiceUser
# Change the run user of the xinetd service
# ex is used in place of ed, since at least on one mandrake release ed
# was not installed, but ex seems to always be installed MOD 7-Nov-2002
changeXinetdServiceUser() {
InitFile=/etc/xinetd.d/firebird
if [ -f $InitFile ]
then
ex -s $InitFile <<EOF
/ user /s/=.*\$/= $RunUser/g
w
q
EOF
fi
}
#------------------------------------------------------------------------
# Update inetd service entry
# This just adds/replaces the service entry line
updateInetdEntry() {
FileName=/etc/inetd.conf
newLine="gds_db stream tcp nowait.30000 $RunUser $FBBin/fb_inet_server gds_inet_server # InterBase Database Remote Server"
oldLine=`grep "^gds_db" $FileName`
replaceLineInFile "$FileName" "$newLine" "$oldLine"
}
#------------------------------------------------------------------------
# Update xinetd service entry
updateXinetdEntry() {
InitFile=/etc/xinetd.d/firebird
cp $FBRootDir/misc/firebird.xinetd $InitFile
chown root:root $InitFile
chmod o=rw,go=r $InitFile
changeXinetdServiceUser
}
#------------------------------------------------------------------------
# Update inetd service entry
# Check to see if we have xinetd installed or plain inetd. Install differs
# for each of them.
updateInetdServiceEntry() {
if [ -d /etc/xinetd.d ]
then
updateXinetdEntry
else
updateInetdEntry
fi
}
#------------------------------------------------------------------------
# Unable to generate the password for the rpm, so put out a message
# instead
keepOrigDBAPassword() {
DBAPasswordFile=$FBRootDir/SYSDBA.password
NewPasswd='masterkey'
echo "Firebird initial install password " > $DBAPasswordFile
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
echo "for install on `hostname` at time `date`" >> $DBAPasswordFile
echo "You should change this password at the earliest oportunity" >> $DBAPasswordFile
echo ""
echo "(For superserver you will also want to check the password in the" >> $DBAPasswordFile
echo "daemon init routine in the file /etc/init.d/firebird)" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
echo "Your should password can be changed to a more suitable one using the" >> $DBAPasswordFile
echo "@prefix@/bin/changeDBAPassword.sh script" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
chmod u=r,go= $DBAPasswordFile
}
#------------------------------------------------------------------------
# Generate new sysdba password - this routine is used only in the
# rpm file not in the install acript.
generateNewDBAPassword() {
DBAPasswordFile=$FBRootDir/SYSDBA.password
NewPasswd=`/usr/bin/mkpasswd -l 8`
if [ -z "$NewPasswd" ]
then
keepOrigDBAPassword
return
fi
echo "Firebird generated password " > $DBAPasswordFile
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
echo "generated on `hostname` at time `date`" >> $DBAPasswordFile
echo "(For superserver you will also want to check the password in the" >> $DBAPasswordFile
echo "daemon init routine in the file /etc/rc.d/init.d/firebird)" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
echo "Your password can be changed to a more suitable one using the" >> $DBAPasswordFile
echo "@prefix@/bin/changeDBAPassword.sh script" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
chmod u=r,go= $DBAPasswordFile
$FBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd
EOF
}
#------------------------------------------------------------------------
# Change sysdba password - this routine is interactive and is only
# used in the install shell script not the rpm one.
askUserForNewDBAPassword() {
NewPasswd=""
while [ -z "$NewPasswd" ]
do
# If using a generated password
# DBAPasswordFile=$FBRootDir/SYSDBA.password
# NewPasswd=`mkpasswd -l 8`
# echo "Password for SYSDBA on `hostname` is : $NewPasswd" > $DBAPasswordFile
# chmod ga-rwx $DBAPasswordFile
AskQuestion "Please enter new password for SYSDBA user: "
NewPasswd=$Answer
if [ ! -z "$NewPasswd" ]
then
$FBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd
EOF
echo ""
fi
done
}
#------------------------------------------------------------------------
# Change sysdba password - this routine is interactive and is only
# used in the install shell script not the rpm one.
# On some systems the mkpasswd program doesn't appear and on others
# there is another mkpasswd which does a different operation. So if
# the specific one isn't available then keep the original password.
changeDBAPassword() {
if [ -z "$InteractiveInstall" ]
then
if [ -f /usr/bin/mkpasswd ]
then
generateNewDBAPassword
else
keepOrigDBAPassword
fi
else
askUserForNewDBAPassword
fi
}
#------------------------------------------------------------------------
# fixFilePermissions
# Change the permissions to restrict access to server programs to
# firebird group only. This is MUCH better from a saftey point of
# view than installing as root user, even if it requires a little
# more work.
fixFilePermissions() {
# Turn other access off.
chmod -R o= $FBRootDir
# Now fix up the mess.
# fix up directories
for i in `find $FBRootDir -print`
do
FileName=$i
if [ -d $FileName ]
then
chmod o=rx $FileName
fi
done
cd $FBBin
# set up the defaults for bin
for i in `ls`
do
chmod ug=rx,o= $i
done
# User can run these programs, they need to talk to server though.
# and they cannot actually create a database.
chmod a=rx isql
chmod a=rx qli
# SUID is still needed for group direct access. General users
# cannot run though.
for i in fb_lock_mgr gds_drop fb_inet_server
do
chmod ug=rx,o= $i
chmod ug+s $i
done
cd $FBRootDir
# Fix lock files
for i in isc_init1 isc_lock1 isc_event1
do
FileName=$i.`hostname`
chmod ug=rw,o= $FileName
done
chmod ug=rw,o= firebird.log
chmod a=r firebird.msg
chmod a=r README
chmod ug=rw,o= help/help.gdb
chmod ug=rw,o= isc4.gdb
# Set a default of read all files in includes
for i in include lib UDF intl misc
do
cd $i
for j in `ls`
do
chmod a=r $j
done
cd ..
done
# Set a default of read all files in examples
cd examples
for i in `ls`
do
chmod a=r $i
done
# make examples db's writable by group
chmod ug=rw,o= *.gdb
}
#------------------------------------------------------------------------
# fixFilePermissionsForRoot
# This sets the file permissions up to what you need if you are
# running the server as root user. I hope to remove this mode
# of running before the next version, since it's security level
# is absolutely woeful.
#
# The main difference between fixFIlePermissionsRoot and fixFilePermissions
# is that non root assumes you must be a member of the group to access most
# of the files, wheras root user install gives world writable permission to
# the installation.
fixFilePermissionsRoot() {
# Turn other access off.
chmod -R o= $FBRootDir
# Now fix up the mess.
# fix up directories
for i in `find $FBRootDir -print`
do
FileName=$i
if [ -d $FileName ]
then
chmod o=rx $FileName
fi
done
cd $FBBin
# set up the defaults for bin
for i in `ls`
do
chmod o=rx $i
done
# SUID is still needed for group direct access. General users
# cannot run though.
for i in fb_lock_mgr gds_drop fb_inet_server
do
chmod ug+s $i
done
cd $FBRootDir
# Set a default of read all files in includes
for i in include lib UDF intl misc
do
cd $i
for j in `ls`
do
chmod a=r $j
done
cd ..
done
# Fix lock files
for i in isc_init1 isc_lock1 isc_event1
do
FileName=$i.`hostname`
chmod a=rw $FileName
done
chmod a=rw firebird.log
chmod a=r firebird.msg
chmod a=r README
chmod a=rw help/help.gdb
chmod a=rw isc4.gdb
# Set a default of read all files in examples
cd examples
for i in `ls`
do
chmod a=r $i
done
# make examples db's writable by group
chmod a=rw *.gdb
}
#------------------------------------------------------------------------
# UpdateHostsDotEquivFile
# The /etc/hosts.equiv file is needed to allow local access for super server
# from processes on the machine to port 3050 on the local machine.
# The two host names that are needed there are
# localhost.localdomain and whatever hostname returns.
UpdateHostsDotEquivFile() {
hostEquivFile=/etc/hosts.equiv
if [ ! -f $hostEquivFile ]
then
touch $hostEquivFile
chown root:root $hostEquivFile
chmod u=rw,go=r $hostEquivFile
fi
newLine="localhost.localdomain"
oldLine=`grep "$newLine" $hostEquivFile`
replaceLineInFile "$hostEquivFile" "$newLine" "$oldLine"
newLine="`hostname`"
oldLine=`grep "$newLine" $hostEquivFile`
replaceLineInFile "$hostEquivFile" "$newLine" "$oldLine"
}
#------------------------------------------------------------------------
# buildUninstallFile
# This will work only for the .tar.gz install and it builds an
# uninstall shell script. The RPM system takes care of it's own.
buildUninstallFile() {
cd $origDir
if [ ! -f manifest.txt ] # Only do this if we are a .tar.gz install
then
return
fi
cp manifest.txt $FBRootDir/misc
cp -r scripts $FBRootDir/misc/
cp scripts/tarMainUninstall.sh $FBRootDir/bin/uninstall.sh
if [ -f /var/run/xinetd.pid ]
then
kill -USR2 `cat /var/run/xinetd.pid`
fi
}
#------------------------------------------------------------------------
# UpdateConfigFile
# Ensure a configuration file /etc/firebird.conf exists.
# save the original one if required.
updateConfigFile() {
configFile=/etc/firebird.conf
if [ -f $configFile ]
then
ArchiveDateTag=`date +"%Y%m%d_%H%M"`
saveConfigFile=$configFile.$ArchiveDateTag
echo "saving previous $configFile as $saveConfigFile"
cp $configFile $configFile.$ArchiveDateTag
fi
cp $FBRootDir/misc/firebird.conf $configFile
}
#------------------------------------------------------------------------
# resetXinitdServer
# Check for both inetd and xinetd, only one will actually be running.
# depending upon your system.
resetInetdServer() {
if [ -f /var/run/inetd.pid ]
then
kill -HUP `cat /var/run/inetd.pid`
fi
if [ -f /var/run/xinetd.pid ]
then
kill -USR2 `cat /var/run/xinetd.pid`
fi
}
#= Main Post ===============================================================
# Make sure the links are in place
if [ -z "$FirebirdInstallPrefix" ]
then
FirebirdInstallPrefix=@prefix@
fi
origDir=`pwd`
FBRootDir=$FirebirdInstallPrefix
FBBin=$FBRootDir/bin
RunUser=root
# RunUser=firebird
# Update /etc/services
# The \n is needed, some /etc/services files are missing a trailing
# line feed - MOD 7-Nov-2002
FileName=/etc/services
newLine="\ngds_db 3050/tcp # FirebirdSQL Database Remote Protocol\n"
oldLine=`grep "^gds_db" $FileName`
if [ -z "$oldLine" ]
then
echo $newLine >> $FileName
# replaceLineInFile "$FileName" "$newLine" "$oldLine"
fi
UpdateHostsDotEquivFile
# add Firebird user
if [ $RunUser = "firebird" ]
then
addFirebirdUser
fi
# Create Lock files
cd $FBRootDir
for i in isc_init1 isc_lock1 isc_event1
do
FileName=$i.`hostname`
touch $FileName
done
# Create log
touch firebird.log
# Update ownership and SUID bits for programs.
chown -R $RunUser.$RunUser $FBRootDir
if [ "$RunUser" = "root" ]
then
fixFilePermissionsRoot
else
fixFilePermissions
fi
updateConfigFile
buildUninstallFile
# Update the /etc/inetd.conf or xinetd entry
updateInetdServiceEntry
# Get inetd to reread new init files.
resetInetdServer
cd $FBRootDir
# Change sysdba password
changeDBAPassword
#keepOrigDBAPassword

View File

@ -0,0 +1,123 @@
#!/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 2002-11-11 05:56:38 skywalker 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

View File

@ -0,0 +1,441 @@
#!/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: preinstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# The pre install routine for Firebird Classic
#------------------------------------------------------------------------
# Prompt for response, store result in Answer
Answer=""
AskQuestion() {
Test=$1
DefaultAns=$2
echo -n "${1}"
Answer="$DefaultAns"
read Answer
}
#------------------------------------------------------------------------
# stop super server if it is running
# Also will only stop firebird, since that has the init script
stopServerIfRunning() {
checkString=`ps -efww| egrep "(fbserver|fbguard)" |grep -v grep`
if [ ! -z "$checkString" ]
then
if [ -f /etc/init.d/firebird ]
then
/etc/init.d/firebird stop
elif [ -f /etc/rc.d/init.d/firebird ]
then
/etc/rc.d/init.d/firebird stop
fi
fi
}
#------------------------------------------------------------------------
# stop server if it is running
checkIfServerRunning() {
stopServerIfRunning
# Check is server is being actively used.
checkString=`ps -efww| egrep "(fbserver|fbguard)" |grep -v grep`
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird Super server seems to be running."
echo "(the ibserver or ibguard process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed"
exit 1
fi
checkString=`ps -efww| egrep "(fb_inet_server|gds_pipe)" |grep -v grep`
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird classic server seems to be running."
echo "(the gds_inet_server or gds_pipe process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed."
exit 1
fi
# The following check for running interbase or firebird 1.0 servers.
checkString=`ps -efww| egrep "(ibserver|ibguard)" |grep -v grep`
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird/InterBase Super server seems to be running."
echo "(the ibserver or ibguard process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed"
exit 1
fi
checkString=`ps -efww| egrep "(gds_inet_server|gds_pipe)" |grep -v grep`
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird/InterBase classic server seems to be running."
echo "(the gds_inet_server or gds_pipe process was detected running on your system)"
echo "Please quit all Firebird applications and then proceed."
exit 1
fi
# This one is commented out, since it usually works out ok, we have
# checked that no procesers are active, but inetd/xinetd is still listening
# the best thing would be to turn the service off, but I don't have time
# to do all the xinetd/inetd stuff, see the preunistall.sh script for details
#
# checkString=`netstat -an | egrep '3050.*LISTEN'`
#
# if [ ! -z "$checkString" ]
# then
# echo "An instance of the Firebird/InterBase server seems to be running."
# echo "(netstat -an reports a process is already listening on port 3050)"
# echo "Please quit all Firebird applications and then proceed."
# exit 1
# fi
# Stop lock manager if it is the only thing running.
for i in `ps -efww | grep "gds_lock_mgr" | grep -v "grep" | awk '{print $2}' `
do
kill $i
done
}
#------------------------------------------------------------------------
# Run process and check status
runAndCheckExit() {
Cmd=$*
# echo $Cmd
$Cmd
ExitCode=$?
if [ $ExitCode -ne 0 ]
then
echo "Install aborted: The command $Cmd "
echo " failed with error code $ExitCode"
exit $ExitCode
fi
}
#------------------------------------------------------------------------
# Display message if this is being run interactively.
displayMessage() {
msgText=$1
if [ ! -z "$InteractiveInstall" ]
then
echo $msgText
fi
}
#------------------------------------------------------------------------
# Archive any existing prior installed files.
# The 'cd' stuff is to avoid the "leading '/' removed message from tar.
# for the same reason the DestFile is specified without the leading "/"
archivePriorInstallSystemFilesX() {
oldPWD=`pwd`
archiveFileList=""
cd /
DestFile="$FBRootDir"
if [ -e "$DestFile" ]
then
echo ""
echo ""
echo ""
echo "--- Warning ----------------------------------------------"
echo " The installation target directory: $FBRootDir"
echo " Already contains a prior installation of Firebird."
echo " This and files found in /usr/include and /usr/lib will be"
echo " archived in the file : ${ArchiveMainFile}"
echo ""
if [ ! -z "$InteractiveInstall" ]
then
AskQuestion "Press return to continue or ^C to abort"
fi
if [ -e $DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
fi
for i in gds.h ibase.h iberror.h ib_util.h
do
DestFile=usr/include/$i
if [ -e $DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
done
for i in gds_pyxis.a gds.a @FIREBIRD_LIBGDS_SO@ libib_util.so libgds.a
do
DestFile=usr/lib/$i
if [ -e $DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
done
for i in usr/sbin/rcfirebird etc/init.d/firebird etc/rc.d/init.d/firebird etc/firebird.conf
do
DestFile=$i
if [ -e $DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
done
if [ ! -z "$archiveFileList" ]
then
displayMessage "Archiving..."
runAndCheckExit "tar -czf $ArchiveMainFile $archiveFileList"
displayMessage "Done."
displayMessage "Deleting..."
for i in $archiveFileList
do
rm -rf $i
done
displayMessage "Done."
fi
cd $oldPWD
}
#------------------------------------------------------------------------
# Archive any existing prior installed files.
# This is mainly for the .tar.gz install since rpm packages take care of
# thier own.
archivePriorInstallSystemFiles() {
if [ ! -f manifest.txt ]
then
return
fi
archiveFileList=""
for i in `cat manifest.txt`
do
if [ ! -d /$i ] # Ignore directories
then
if [ -e /$i ]
then
archiveFileList="$archiveFileList $i"
fi
fi
done
for i in usr/sbin/rcfirebird etc/init.d/firebird etc/rc.d/init.d/firebird
do
DestFile=./$i
if [ -e /$DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
done
deleteFileList="$archiveFileList"
# The following files want to be archived just in case but are not deleted
# since they are a little special and are handled specially in the install
for i in etc/firebird.conf
do
DestFile=./$i
if [ -e /$DestFile ]
then
archiveFileList="$archiveFileList $DestFile"
fi
done
DestFile="$FBRootDir"
if [ ! -z "$archiveFileList" ]
then
cat <<EOF
** Warning **
Some existing files have been detected from a prior install of
FirebirdSQL (or InterBase). These files will be archived in
file : ${ArchiveMainFile}
and then deleted.
EOF
if [ ! -z "$InteractiveInstall" ]
then
AskQuestion "Press return to continue or ^C to abort"
fi
fi
if [ ! -z "$archiveFileList" ]
then
displayMessage "Archiving..."
runAndCheckExit "tar -C / -czf $ArchiveMainFile $archiveFileList"
displayMessage "Done."
displayMessage "Deleting..."
oldPWD=`pwd`
cd /
for i in $deleteFileList
do
echo $i
#rm -f $i
done
cd $oldPWD
displayMessage "Done."
fi
}
#------------------------------------------------------------------------
# Check for installed RPM package
# (Pavel I've left this in since originally I could test for other packages,
# even if they did not conflict with current ones, ie we can test InterBase
# and CS/SS The package manager does not allow it currently but I've left
# this in in case that sort of thing gets allowed again
checkForRPMInstall() {
PackageName=$1
rpm -q $PackageName
STATUS=$?
if [ $STATUS -eq 0 ]
then
echo "Previous version of $PackageName is detected on your system."
echo "this will conflict with the current install of Firebird"
echo "Please unistall the previous version `rpm -q $PackageName` and then proceed."
exit $STATUS
fi
}
#= Main Pre ================================================================
if [ -z "$FirebirdInstallPrefix" ]
then
FirebirdInstallPrefix=@prefix@
fi
FBRootDir=$FirebirdInstallPrefix
FBBin=$FBRootDir/bin
ArchiveDateTag=`date +"%Y%m%d_%H%M"`
ArchiveMainFile="${FBRootDir}_${ArchiveDateTag}.tar.gz"
# Ok so any of the following packages are a problem
# these don't work at least in the latest rpm manager, since it
# has the rpm database locked and it fails.
# checkForRPMInstall InterBase
# checkForRPMInstall FirebirdCS
# checkForRPMInstall FirebirdSS
checkIfServerRunning
# Failing that we archive any files we find
archivePriorInstallSystemFiles

View File

@ -0,0 +1,97 @@
#! /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: preuninstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# The pre uninstall routines for Firebird Classic
#------------------------------------------------------------------------
# stop server if it is running
checkIfServerRunning() {
# Check is server is being actively used.
checkString=`ps -ef| egrep "(gds_inet_server|gds_pipe)" |grep -v grep`
if [ ! -z "$checkString" ]
then
echo "An instance of the Firebird/InterBase server seems to be running."
echo "(the gds_inet_server or gds_pipe process was detected running on your system)"
echo "Please quit all interbase applications and then proceed."
exit 1
fi
# Stop lock manager if it is the only thing running.
for i in `ps -ef | grep "gds_lock_mgr" | grep -v "grep" | cut -d' ' -f3`
do
kill $i
done
}
#= Main PreUn ================================================================
# This is a bit simple, but should work for now.
# cron will remove files in /tmp after a while.
if [ -z "$FirebirdInstallPrefix" ]
then
FirebirdInstallPrefix=@prefix@
fi
FBRootDir=$FirebirdInstallPrefix
FBBin=$FBRootDir/bin
checkIfServerRunning
cd $FBRootDir
if [ -f isc4.gdb ]
then
cp isc4.gdb /tmp
echo "Saved a copy of isc4.gdb in /tmp"
fi
for i in isc_init1* isc_event1* isc_lock1* isc_guard* firebird.log SYSDBA.password
do
if [ -f $i ]
then
rm -f $i
fi
done

View File

@ -0,0 +1,3 @@
/

View File

@ -0,0 +1,18 @@
Summary: Firebird Relational Database Server and Client tools.
Name: Firebird@ARCH_TYPE_SUFFIX@
Version: @FIREBIRD_VERSION@.@FB_BUILD_NUM@
Release: @FIREBIRD_PACKAGE_VERSION@
Copyright: Distributable
Group: Applications/Databases
Source: FirebirdCS0.9src.tar.gz
URL: http://firebird.sourceforge.net
Prefix: /
AutoReqProv: no
BuildArchitectures: @CPU_TYPE@
# BuildRoot: /var/tmp/%{name}-buildroot
BuildRoot: @BUILD_ROOT_DIR@/gen/buildroot
%description
Firebird is a powerful, high-performance relational database designed to be embedded into
applications on multiple platforms.

View File

@ -0,0 +1,156 @@
#!/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: tarMainInstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# Install script for FirebirdSQL database engine
# http://www.firebirdsql.org
# This is the new file !!!
#------------------------------------------------------------------------
# Prompt for response, store result in Answer
Answer=""
AskQuestion() {
Test=$1
DefaultAns=$2
echo -n "${1}"
Answer="$DefaultAns"
read Answer
}
#------------------------------------------------------------------------
# Prompt for yes or no answer - returns non-zero for no
AskYNQuestion() {
while echo -n "${*} (y/n): "
do
read answer rest
case $answer in
[yY]*)
return 0
;;
[nN]*)
return 1
;;
*)
echo "Please answer y or n"
;;
esac
done
}
#------------------------------------------------------------------------
# Run process and check status
runAndCheckExit() {
Cmd=$*
# echo $Cmd
$Cmd
ExitCode=$?
if [ $ExitCode -ne 0 ]
then
echo "Install aborted: The command $Cmd "
echo " failed with error code $ExitCode"
exit
fi
}
#------------------------------------------------------------------------
# Check for a previous install
checkInstallUser() {
if [ "`whoami`" != "root" ];
then
echo ""
echo "--- Warning ----------------------------------------------"
echo ""
echo " You need to be 'root' user to install"
echo ""
exit
fi
}
#== Main Program ==========================================================
InteractiveInstall=1
export InteractiveInstall
checkInstallUser
BuildVersion=@FIREBIRD_VERSION@.@FB_BUILD_NUM@
PackageVersion=@FIREBIRD_PACKAGE_VERSION@
CpuType=@CPU_TYPE@
Version="$BuildVersion-$PackageVersion.$CpuType"
cat <<EOF
Firebird @FIREBIRD_ARCH_TYPE@ $Version Installation
EOF
AskQuestion "Press Enter to start installation or ^C to abort"
# Here we are installing from a install tar.gz file
if [ -e scripts ]
then
echo "Extracting install data"
runAndCheckExit "./scripts/preinstall.sh"
runAndCheckExit "./scripts/tarinstall.sh"
runAndCheckExit "./scripts/postinstall.sh"
fi
echo "Install completed"

View File

@ -0,0 +1,167 @@
#!/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: tarMainUninstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# Install script for FirebirdSQL database engine
# http://www.firebirdsql.org
# This is the new file !!!
#------------------------------------------------------------------------
# Prompt for response, store result in Answer
Answer=""
AskQuestion() {
Test=$1
DefaultAns=$2
echo -n "${1}"
Answer="$DefaultAns"
read Answer
}
#------------------------------------------------------------------------
# Prompt for yes or no answer - returns non-zero for no
AskYNQuestion() {
while echo -n "${*} (y/n): "
do
read answer rest
case $answer in
[yY]*)
return 0
;;
[nN]*)
return 1
;;
*)
echo "Please answer y or n"
;;
esac
done
}
#------------------------------------------------------------------------
# Run process and check status
runAndCheckExit() {
Cmd=$*
# echo $Cmd
$Cmd
ExitCode=$?
if [ $ExitCode -ne 0 ]
then
echo "Uninstall aborted: The command $Cmd "
echo " failed with error code $ExitCode"
exit
fi
}
#------------------------------------------------------------------------
# Check for a previous install
checkInstallUser() {
if [ "`whoami`" != "root" ];
then
echo ""
echo "--- Warning ----------------------------------------------"
echo ""
echo " You need to be 'root' user to run uninstall"
echo ""
exit
fi
}
#== Main Program ==========================================================
InteractiveInstall=1
export InteractiveInstall
checkInstallUser
BuildVersion=@FIREBIRD_VERSION@.@FB_BUILD_NUM@
PackageVersion=@FIREBIRD_PACKAGE_VERSION@
CpuType=@CPU_TYPE@
FBRootDir=@prefix@
Version="$BuildVersion-$PackageVersion.$CpuType"
cat <<EOF
Firebird @FIREBIRD_ARCH_TYPE@ $Version Uninstall program
Are you sure you want to proceed?
EOF
AskQuestion "Press Enter to start uninstall or ^C to abort"
# Here we are uninstalling from a install tar.gz file
scriptsDir=$FBRootDir/misc/scripts
if [ -e $scriptsDir ]
then
echo "Extracting install data"
runAndCheckExit "$scriptsDir/preuninstall.sh"
runAndCheckExit "$scriptsDir/postuninstall.sh"
# This one is done last since it deletes the script files
# as well.
runAndCheckExit "$scriptsDir/taruninstall.sh"
fi
echo "Uninstall completed"

View File

@ -0,0 +1,47 @@
#! /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: tarinstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
# THe way this works is that the buildroot file is stored relative to the root
# directory and a tar -xzf at root directory will restore all the files in
# the position that we want them to be
OrigDir=`pwd`
cd /
tar -xzf $OrigDir/buildroot.tar.gz
cd $OrigDir

View File

@ -0,0 +1,115 @@
#! /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: taruninstall.sh.in,v 1.1 2002-11-11 05:56:38 skywalker Exp $
#
#------------------------------------------------------------------------
# removeInstalledFiles
#
removeInstalledFiles() {
manifestFile=$FBRootDir/misc/manifest.txt
if [ ! -f $manifestFile ]
then
return
fi
origDir=`pwd`
cd /
for i in `cat $manifestFile`
do
if [ -f $i -o -L $i ]
then
rm -f $i
#echo $i
fi
done
cd $origDir
}
#------------------------------------------------------------------------
# removeUninstallFiles
# Under the install directory remove all the empty directories
# If some files remain then
removeUninstallFiles() {
# remove the uninstall scripts files.
#echo $FBRootDir/misc/scripts
rm -rf $FBRootDir/misc/scripts
rm -f $FBRootDir/misc/manifest.txt
rm -f $FBRootDir/bin/uninstall.sh
}
#------------------------------------------------------------------------
# removeEmptyDirs
# Under the install directory remove all the empty directories
# If some files remain then
# This routing loops, since deleting a directory possibly makes
# the parent empty as well
removeEmptyDirs() {
dirContentChanged='yes'
while [ ! -z $dirContentChanged ]
do
dirContentChanged=''
for i in `find $FBRootDir -empty -type d -print`
do
rmdir $i
dirContentChanged=$i
done
if [ ! -d $FBRootDir ] # end loop if the FBRootDir was deleted.
then
dirContentChanged=''
fi
done
}
FBRootDir=@prefix@
FBBin=$FBRootDir/bin
removeInstalledFiles # Remove installed files
removeUninstallFiles # Remove the 'uninstall' utility files
removeEmptyDirs # Remove empty directories