diff --git a/src/install/arch-specific/linux/classic/install.sh.in b/src/install/arch-specific/linux/classic/install.sh.in new file mode 100755 index 0000000000..909fd75c6d --- /dev/null +++ b/src/install/arch-specific/linux/classic/install.sh.in @@ -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 +# +# 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 + diff --git a/src/install/arch-specific/linux/classic/makeInstallImage.sh.in b/src/install/arch-specific/linux/classic/makeInstallImage.sh.in new file mode 100755 index 0000000000..89a0d63923 --- /dev/null +++ b/src/install/arch-specific/linux/classic/makeInstallImage.sh.in @@ -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 +# +# 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 diff --git a/src/install/arch-specific/linux/classic/postinstall.sh.in b/src/install/arch-specific/linux/classic/postinstall.sh.in new file mode 100755 index 0000000000..d6ee922e2b --- /dev/null +++ b/src/install/arch-specific/linux/classic/postinstall.sh.in @@ -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 +# +# 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 < $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 < $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 <> $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 + + + diff --git a/src/install/arch-specific/linux/classic/postuninstall.sh.in b/src/install/arch-specific/linux/classic/postuninstall.sh.in new file mode 100755 index 0000000000..6e09c5bd0d --- /dev/null +++ b/src/install/arch-specific/linux/classic/postuninstall.sh.in @@ -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 +# +# 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 diff --git a/src/install/arch-specific/linux/classic/preinstall.sh.in b/src/install/arch-specific/linux/classic/preinstall.sh.in new file mode 100755 index 0000000000..ff9fa4780f --- /dev/null +++ b/src/install/arch-specific/linux/classic/preinstall.sh.in @@ -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 +# +# 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 < +# +# 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 diff --git a/src/install/arch-specific/linux/classic/rpmfiles.txt.in b/src/install/arch-specific/linux/classic/rpmfiles.txt.in new file mode 100644 index 0000000000..3f5c2f7ef4 --- /dev/null +++ b/src/install/arch-specific/linux/classic/rpmfiles.txt.in @@ -0,0 +1,3 @@ +/ + + diff --git a/src/install/arch-specific/linux/classic/rpmheader.txt.in b/src/install/arch-specific/linux/classic/rpmheader.txt.in new file mode 100644 index 0000000000..1f5220a6d9 --- /dev/null +++ b/src/install/arch-specific/linux/classic/rpmheader.txt.in @@ -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. + diff --git a/src/install/arch-specific/linux/classic/tarMainInstall.sh.in b/src/install/arch-specific/linux/classic/tarMainInstall.sh.in new file mode 100755 index 0000000000..986ed5b5f9 --- /dev/null +++ b/src/install/arch-specific/linux/classic/tarMainInstall.sh.in @@ -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 +# +# 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 < +# +# 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 < +# +# 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 diff --git a/src/install/arch-specific/linux/classic/taruninstall.sh.in b/src/install/arch-specific/linux/classic/taruninstall.sh.in new file mode 100644 index 0000000000..6e0ac2c4cd --- /dev/null +++ b/src/install/arch-specific/linux/classic/taruninstall.sh.in @@ -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 +# +# 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