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

merge 1.5 install files to 2.0

This commit is contained in:
alexpeshkoff 2005-03-13 16:04:59 +00:00
parent d15c717b52
commit 11e1bfcdec
14 changed files with 721 additions and 280 deletions

View File

@ -30,7 +30,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: makeInstallImage.sh.in,v 1.8 2005-02-24 12:23:02 alexpeshkoff Exp $ # $Id: makeInstallImage.sh.in,v 1.9 2005-03-13 16:04:33 alexpeshkoff Exp $
# #
# Script to copy install files from the build/transport area # Script to copy install files from the build/transport area
@ -123,6 +123,9 @@ copyFiles() {
cp $BuiltFBDir/bin/CSchangeRunUser.sh $DestDir/bin cp $BuiltFBDir/bin/CSchangeRunUser.sh $DestDir/bin
cp $BuiltFBDir/bin/CSrestoreRootRunUser.sh $DestDir/bin cp $BuiltFBDir/bin/CSrestoreRootRunUser.sh $DestDir/bin
cp $BuiltFBDir/bin/changeDBAPassword.sh $DestDir/bin cp $BuiltFBDir/bin/changeDBAPassword.sh $DestDir/bin
cp $BuiltFBDir/bin/changeGdsLibraryCompatibleLink.sh $DestDir/bin
cp $BuiltFBDir/bin/createAliasDB.sh $DestDir/bin
cp $BuiltFBDir/bin/fb_config $DestDir/bin
# Copy examples only if we have them # Copy examples only if we have them
@ -144,7 +147,7 @@ copyFiles() {
#cp -r $BuiltFBDir/doc $DestDir #cp -r $BuiltFBDir/doc $DestDir
cp $BuiltFBDir/firebird.msg $DestDir/firebird.msg cp $BuiltFBDir/firebird.msg $DestDir/firebird.msg
cp $BuiltFBDir/security2.fdb $DestDir/security2.fdb cp $BuiltFBDir/$SecurityDatabase $DestDir/$SecurityDatabase
# cp $BuiltFBDir/include/gds.f $DestDir/include # cp $BuiltFBDir/include/gds.f $DestDir/include
@ -154,7 +157,7 @@ copyFiles() {
cp -df $BuiltFBDir/lib/libfbembed.so* $DestDir/lib cp -df $BuiltFBDir/lib/libfbembed.so* $DestDir/lib
cp -df $BuiltFBDir/lib/libfbclient.so* $DestDir/lib cp -df $BuiltFBDir/lib/libfbclient.so* $DestDir/lib
# cp -f $BuiltFBDir/lib/gds.a /usr/lib/libgds.a # cp -f $BuiltFBDir/lib/gds.a @libdir@/libgds.a
cp -f $BuiltFBDir/lib/libib_util.so $DestDir/lib/libib_util.so cp -f $BuiltFBDir/lib/libib_util.so $DestDir/lib/libib_util.so
@ -176,16 +179,8 @@ copyFiles() {
cp $BuiltFBDir/misc/firebird.xinetd $DestDir/misc/firebird.xinetd cp $BuiltFBDir/misc/firebird.xinetd $DestDir/misc/firebird.xinetd
cp $BuiltFBDir/misc/firebird.conf $DestDir/firebird.conf cp $BuiltFBDir/misc/firebird.conf $DestDir/firebird.conf
cp $BuiltFBDir/misc/aliases.conf $DestDir/aliases.conf
echo "#" >> $DestDir/aliases.conf
echo "# List of known database aliases" >> $DestDir/aliases.conf
echo "# ------------------------------" >> $DestDir/aliases.conf
echo "#" >> $DestDir/aliases.conf
echo "# Examples:" >> $DestDir/aliases.conf
echo "#" >> $DestDir/aliases.conf
echo "# employee = /$FBRootDir/examples/employee.fdb" >> $DestDir/aliases.conf
echo "#" >> $DestDir/aliases.conf
# Create links from @libdir@ to install area. # Create links from @libdir@ to install area.
@ -199,7 +194,7 @@ copyFiles() {
# link include files to /usr/include # link include files to /usr/include
for i in iberror.h ibase.h ib_util.h for i in gds.h iberror.h ibase.h ib_util.h
do do
ln -s ../../$FBRootDir/include/$i $TargetDir/usr/include/$i ln -s ../../$FBRootDir/include/$i $TargetDir/usr/include/$i
done done
@ -217,5 +212,6 @@ copyFiles() {
#=== MAIN ==================================================================== #=== MAIN ====================================================================
SecurityDatabase=security2.fdb
copyFiles copyFiles

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# This library is part of the FirebirdSQL project # This library is part of the Firebird project
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -31,7 +31,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: postinstall.sh.in,v 1.8 2005-02-24 12:23:02 alexpeshkoff Exp $ # $Id: postinstall.sh.in,v 1.9 2005-03-13 16:04:33 alexpeshkoff Exp $
# #
# The post install script for Firebird Classic # The post install script for Firebird Classic
@ -88,6 +88,46 @@ replaceLineInFile() {
fi fi
} }
#------------------------------------------------------------------------
# Detect Distribution.
detectDistro() {
# it's not provided...
if [ -z "$linuxDistro" ]
then
if [ -e /etc/SuSE-release ]
then
# SuSE
linuxDistro="SuSE"
elif [ -e /etc/mandrake-release ]
then
# Mandrake
linuxDistro="MDK"
elif [ -e /etc/debian_version ]
then
# Debian
linuxDistro="Debian"
elif [ -e /etc/gentoo-release ]
then
# Debian
linuxDistro="Gentoo"
elif [ -e /etc/rc.d/init.d/functions ]
then
# very likely Red Hat
linuxDistro="RH"
elif [ -d /etc/rc.d/init.d ]
then
# generic Red Hat
linuxDistro="G-RH"
elif [ -d /etc/init.d ]
then
# generic SuSE
linuxDistro="G-SuSE"
fi
fi
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Add new user and group # Add new user and group
@ -96,18 +136,14 @@ addFirebirdUser() {
testStr=`grep firebird /etc/group` testStr=`grep firebird /etc/group`
if [ -z "$testStr" ] if [ -z "$testStr" ]; then
then
groupadd firebird groupadd firebird
fi fi
testStr=`grep firebird /etc/passwd` testStr=`grep firebird /etc/passwd`
if [ -z "$testStr" ] if [ -z "$testStr" ]; then
then
useradd -M -d $FBRootDir -s /bin/bash \ useradd -M -d $FBRootDir -s /bin/bash \
-c "Firebird Database Administrator" -g firebird firebird -c "Firebird Database Administrator" -g firebird firebird
# >/dev/null 2>&1
fi fi
} }
@ -189,32 +225,43 @@ updateInetdServiceEntry() {
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Unable to generate the password for the rpm, so put out a message # Write new password to the @prefix@/SYSDBA.password file
# instead
writeNewPassword() {
keepOrigDBAPassword() { NewPasswd=$1
DBAPasswordFile=$FBRootDir/SYSDBA.password echo "# Firebird generated password for user SYSDBA is: " > $DBAPasswordFile
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 echo "" >> $DBAPasswordFile
echo "ISC_USER=sysdba" >> $DBAPasswordFile
echo "ISC_PASSWD=$NewPasswd" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
if [ $NewPasswd = "masterkey" ]
then
echo "# for install on `hostname` at time `date`" >> $DBAPasswordFile
echo "# You should change this password at the earliest oportunity" >> $DBAPasswordFile
else
echo "# generated on `hostname` at time `date`" >> $DBAPasswordFile
fi
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 chmod u=r,go= $DBAPasswordFile
# Only if we have changed the password from the default do we need
# to update the entry in the database
if [ $NewPasswd != "masterkey" ]
then
$FBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd
EOF
fi
} }
@ -230,7 +277,8 @@ generateNewDBAPassword() {
# openssl generates random data. # openssl generates random data.
if [ -f /usr/bin/openssl ] if [ -f /usr/bin/openssl ]
then then
NewPasswd=`openssl rand -base64 10 | cut -c1-8` # We generate 20 random chars, strip any '/''s and get the first 8
NewPasswd=`openssl rand -base64 20 | tr -d '/' | cut -c1-8`
fi fi
# mkpasswd is a bit of a hassle, but check to see if it's there # mkpasswd is a bit of a hassle, but check to see if it's there
@ -242,26 +290,16 @@ generateNewDBAPassword() {
fi fi
fi fi
# So we failed to generate a new password, so keep the original
# installed one.
if [ -z "$NewPasswd" ] if [ -z "$NewPasswd" ]
then then
keepOrigDBAPassword NewPasswd="masterkey"
return
fi fi
echo "Firebird generated password " > $DBAPasswordFile writeNewPassword $NewPasswd
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
} }
@ -286,10 +324,12 @@ askUserForNewDBAPassword() {
NewPasswd=$Answer NewPasswd=$Answer
if [ ! -z "$NewPasswd" ] if [ ! -z "$NewPasswd" ]
then then
$FBBin/gsec -user sysdba -password masterkey <<EOF $FBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd modify sysdba -pw $NewPasswd
EOF EOF
echo "" echo ""
#writeNewPassword $NewPasswd
fi fi
done done
@ -308,16 +348,8 @@ EOF
changeDBAPassword() { changeDBAPassword() {
if [ -z "$InteractiveInstall" ] if [ -z "$InteractiveInstall" ]
then then
if [ -f /usr/bin/mkpasswd ] generateNewDBAPassword
then
generateNewDBAPassword
elif [ -f /usr/bin/openssl ]
then
generateNewDBAPassword
else
keepOrigDBAPassword
fi
else else
askUserForNewDBAPassword askUserForNewDBAPassword
fi fi
@ -391,12 +423,12 @@ fixFilePermissions() {
chmod ug=rw,o= firebird.log chmod ug=rw,o= firebird.log
chmod a=r aliases.conf chmod u=rw,go=r aliases.conf
chmod a=r firebird.conf chmod u=rw,go=r firebird.conf
chmod a=r firebird.msg chmod a=r firebird.msg
chmod a=r README chmod a=r README
chmod ug=rw,o= help/help.fdb chmod ug=rw,o= help/help.fdb
chmod ug=rw,o= security2.fdb chmod ug=rw,o= $SecurityDatabase
# Set a default of read all files in includes # Set a default of read all files in includes
@ -425,7 +457,7 @@ fixFilePermissions() {
done done
# make examples db's writable by group # make examples db's writable by group
for i in `find . -name '*.gdb' -print` for i in `find . -name '*.fdb' -print`
do do
chmod ug=rw,o= $i chmod ug=rw,o= $i
done done
@ -516,7 +548,7 @@ fixFilePermissionsRoot() {
chmod a=r firebird.msg chmod a=r firebird.msg
chmod a=r README chmod a=r README
chmod a=rw help/help.fdb chmod a=rw help/help.fdb
chmod a=rw security2.fdb chmod a=rw $SecurityDatabase
# fix up permissions for loadable plugins # fix up permissions for loadable plugins
chmod a=rx intl/fbintl UDF/fbudf.so UDF/ib_udf.so chmod a=rx intl/fbintl UDF/fbudf.so UDF/ib_udf.so
@ -587,11 +619,6 @@ buildUninstallFile() {
cp -r scripts $FBRootDir/misc/ cp -r scripts $FBRootDir/misc/
cp scripts/tarMainUninstall.sh $FBRootDir/bin/uninstall.sh cp scripts/tarMainUninstall.sh $FBRootDir/bin/uninstall.sh
if [ -f /var/run/xinetd.pid ]
then
kill -USR2 `cat /var/run/xinetd.pid`
fi
} }
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -625,14 +652,41 @@ createLinksForBackCompatibility() {
# to ensure it loads the fb equivalent. Eventually these should be # to ensure it loads the fb equivalent. Eventually these should be
# optional and in a seperate rpm install. MOD 7-Nov-2002. # optional and in a seperate rpm install. MOD 7-Nov-2002.
# There are two options for classic for libgds.so :
# 1) The multithreaded client only libfbclient.so
# or
# 2) The direct connect (but not threadsafe) classic libfbembeded.so
#
# libfbclient should be the prefered option unless you need to connect
# in an embedded mode. However the default for install of classic
# is left for libgds.so -> libfbembed.so since that is compatible to
# the existing behaviour of previous installs. (There is also a
# script installed to allow the user to change the option) MOD 23-Dec-2003
#newLibrary=$FBRootDir/lib/libfbclient.so
newLibrary=$FBRootDir/lib/libfbembed.so
# Remove if only a link
if [ -L @libdir@/libgds.so ]
then
rm -f @libdir@/libgds.so
fi
if [ ! -e @libdir@/libgds.so ] if [ ! -e @libdir@/libgds.so ]
then then
ln -s $FBRootDir/lib/libfbembed.so @libdir@/libgds.so ln -s $newLibrary @libdir@/libgds.so
fi
# Remove if only a link
if [ -L @libdir@/libgds.so.0 ]
then
rm -f @libdir@/libgds.so.0
fi fi
if [ ! -e @libdir@/libgds.so.0 ] if [ ! -e @libdir@/libgds.so.0 ]
then then
ln -s $FBRootDir/lib/libfbembed.so @libdir@/libgds.so.0 ln -s $newLibrary @libdir@/libgds.so.0
fi fi
@ -645,6 +699,9 @@ createLinksForBackCompatibility() {
# Detect which linux distro we are installing on
detectDistro
# Make sure the links are in place # Make sure the links are in place
if [ -z "$FirebirdInstallPrefix" ] if [ -z "$FirebirdInstallPrefix" ]
then then
@ -657,6 +714,7 @@ createLinksForBackCompatibility() {
FBBin=$FBRootDir/bin FBBin=$FBRootDir/bin
# RunUser=root # RunUser=root
RunUser=firebird RunUser=firebird
SecurityDatabase=security2.fdb
# Update /etc/services # Update /etc/services
@ -664,7 +722,7 @@ createLinksForBackCompatibility() {
# The \n is needed, some /etc/services files are missing a trailing # The \n is needed, some /etc/services files are missing a trailing
# line feed - MOD 7-Nov-2002 # line feed - MOD 7-Nov-2002
FileName=/etc/services FileName=/etc/services
newLine="gds_db 3050/tcp # FirebirdSQL Database Remote Protocol" newLine="gds_db 3050/tcp # Firebird SQL Database Remote Protocol"
oldLine=`grep "^gds_db" $FileName` oldLine=`grep "^gds_db" $FileName`
if [ -z "$oldLine" ] if [ -z "$oldLine" ]
then then

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# This library is part of the FirebirdSQL project # This library is part of the Firebird project
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
@ -31,7 +31,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: postuninstall.sh.in,v 1.1 2003-07-08 22:59:57 brodsom Exp $ # $Id: postuninstall.sh.in,v 1.2 2005-03-13 16:04:33 alexpeshkoff Exp $
# #
# The post uninstall routine for Firebird Classic. # The post uninstall routine for Firebird Classic.
@ -92,12 +92,42 @@ removeInetDService() {
} }
#------------------------------------------------------------------------
# Delete new user and group
deleteFirebirdUser() {
userdel firebird
# groupdel firebird
}
#------------------------------------------------------------------------
# removeLinksForBackCompatibility
# Remove links for back compatibility to InterBase and Firebird1.0
# linked systems.
removeLinksForBackCompatibility() {
if [ -L @libdir@/libgds.so ]
then
rm -f @libdir@/libgds.so
fi
if [ -L @libdir@/libgds.so.0 ]
then
rm -f @libdir@/libgds.so.0
fi
}
#= Main PostUn ============================================================ #= Main PostUn ============================================================
# I don't think this is needed anymore. # I don't think this is needed anymore.
# if [ -L /usr/lib/libgds.so ] # if [ -L @libdir@/libgds.so ]
# then # then
# rm /usr/lib/libgds.so # rm @libdir@/libgds.so
# fi # fi
if [ "$1"=0 ] if [ "$1"=0 ]
@ -111,6 +141,7 @@ removeInetDService() {
#oldLine=`grep "^gds_db" $FileName` #oldLine=`grep "^gds_db" $FileName`
#removeLineFromFile "$FileName" "$oldLine" #removeLineFromFile "$FileName" "$oldLine"
removeLinksForBackCompatibility
if [ -d /etc/xinetd.d ] if [ -d /etc/xinetd.d ]
then then

View File

@ -31,7 +31,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: preinstall.sh.in,v 1.4 2004-04-27 12:36:30 brodsom Exp $ # $Id: preinstall.sh.in,v 1.5 2005-03-13 16:04:33 alexpeshkoff Exp $
# #
@ -188,95 +188,6 @@ displayMessage() {
} }
#------------------------------------------------------------------------
# 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 @libdir@ 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 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 libfbembed.so.@FIREBIRD_VERSION@ libfbclient.so.@FIREBIRD_VERSION@ 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
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. # Archive any existing prior installed files.
# This is mainly for the .tar.gz install since rpm packages take care of # This is mainly for the .tar.gz install since rpm packages take care of
@ -357,8 +268,7 @@ EOF
cd / cd /
for i in $deleteFileList for i in $deleteFileList
do do
echo $i rm -f $i
#rm -f $i
done done
cd $oldPWD cd $oldPWD
@ -366,8 +276,6 @@ EOF
displayMessage "Done." displayMessage "Done."
fi fi
} }

View File

@ -31,7 +31,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: preuninstall.sh.in,v 1.2 2005-02-24 12:23:02 alexpeshkoff Exp $ # $Id: preuninstall.sh.in,v 1.3 2005-03-13 16:04:33 alexpeshkoff Exp $
# #
# The pre uninstall routines for Firebird Classic # The pre uninstall routines for Firebird Classic
@ -77,15 +77,16 @@ checkIfServerRunning() {
FBRootDir=$FirebirdInstallPrefix FBRootDir=$FirebirdInstallPrefix
FBBin=$FBRootDir/bin FBBin=$FBRootDir/bin
SecurityDatabase=security2.fdb
checkIfServerRunning checkIfServerRunning
cd $FBRootDir cd $FBRootDir
if [ -f security2.fdb ] if [ -f $SecurityDatabase ]
then then
cp security2.fdb /tmp cp $SecurityDatabase /tmp
echo "Saved a copy of security2.fdb in /tmp" echo "Saved a copy of $SecurityDatabase in /tmp"
fi fi
for i in isc_init1* isc_event1* isc_lock1* isc_guard* firebird.log SYSDBA.password for i in isc_init1* isc_event1* isc_lock1* isc_guard* firebird.log SYSDBA.password

View File

@ -4,7 +4,7 @@ Version: @FIREBIRD_VERSION@.@FB_BUILD_NUM@
Release: @FIREBIRD_PACKAGE_VERSION@ Release: @FIREBIRD_PACKAGE_VERSION@
Copyright: Distributable Copyright: Distributable
Group: Applications/Databases Group: Applications/Databases
Source: FirebirdCS0.9src.tar.gz Source: Firebird-@FIREBIRD_VERSION@.@FB_BUILD_NUM@.tar.bz2
URL: http://firebird.sourceforge.net URL: http://firebird.sourceforge.net
# Prefix: / # Prefix: /
AutoReqProv: no AutoReqProv: no

View File

@ -1,8 +1,7 @@
#! /bin/sh #! /bin/sh
# This shell script changes both the SYSDBA user and the firebird # This shell script changes both the SYSDBA user
# install script (for SS installations).
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Prompt for response, store result in Answer # Prompt for response, store result in Answer
@ -25,60 +24,110 @@ AskQuestion() {
changeInitPassword() { changeInitPassword() {
NewPasswd=$1 NewPasswd=$1
DBAPasswordFile=$FBRootDir/SYSDBA.password
InitFile=/etc/rc.d/init.d/firebird InitFile=/etc/rc.d/init.d/firebird
if [ ! -f $InitFile ] if [ ! -f $InitFile ]
then then
InitFile=/etc/init.d/firebird InitFile=/etc/init.d/firebird
fi fi
if [ -f $InitFile ] if [ -f $InitFile ]
then then
ed $InitFile <<EOF echo ""
echo Running ex to modify $InitFile
chmod u=rw,g=,o= $InitFile
ex $InitFile <<EOF
/ISC_PASSWORD/s/ISC_PASSWORD=.*/ISC_PASSWORD=$NewPasswd/g /ISC_PASSWORD/s/ISC_PASSWORD=.*/ISC_PASSWORD=$NewPasswd/g
w w
q q
EOF EOF
chmod u=rwx,g=rx,o= $InitFile chmod u=rwx,g=rx,o= $InitFile
fi fi
} }
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Generate new sysdba password # Write new password to the @prefix@/SYSDBA.password file
writeNewPassword() {
NewPasswd=$1
DBAPasswordFile=$FBRootDir/SYSDBA.password
echo "# Firebird generated password for user SYSDBA is: " > $DBAPasswordFile
echo "" >> $DBAPasswordFile
echo "ISC_USER=sysdba" >> $DBAPasswordFile
echo "ISC_PASSWD=$NewPasswd" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
if [ $NewPasswd = "masterkey" ]
then
echo "# for install on `hostname` at time `date`" >> $DBAPasswordFile
echo "# You should change this password at the earliest oportunity" >> $DBAPasswordFile
else
echo "# generated on `hostname` at time `date`" >> $DBAPasswordFile
fi
echo "" >> $DBAPasswordFile
echo "# Your password can be changed to a more suitable one using the" >> $DBAPasswordFile
echo "# @prefix@/bin/changeDBAPassword.sh script" >> $DBAPasswordFile
# Additional instructions for super server
echo "" >> $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
chmod u=r,go= $DBAPasswordFile
}
#------------------------------------------------------------------------
# Generate new sysdba password - this routine is used only in the
# rpm file not in the install acript.
generateNewDBAPassword() { generateNewDBAPassword() {
DBAPasswordFile=$IBRootDir/SYSDBA.password
NewPasswd=`mkpasswd -l 8`
echo "Firebird generated password " > $DBAPasswordFile
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
echo "generated on `hostname` at time `date`" >> $DBAPasswordFile
echo "" >> $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/gsec program as show below:" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
echo ">cd @prefix@" >> $DBAPasswordFile
echo ">bin/gsec -user sysdba -password <password>" >> $DBAPasswordFile
echo "GSEC>modify sysdba -pw <newpassword>" >> $DBAPasswordFile
echo "GSEC>quit" >> $DBAPasswordFile
chmod u=rw,go= $DBAPasswordFile # openssl generates random data.
if [ -f /usr/bin/openssl ]
then
# We generate 20 random chars, strip any '/''s and get the first 8
NewPasswd=`openssl rand -base64 20 | tr -d '/' | cut -c1-8`
fi
$IBBin/gsec -user sysdba -password masterkey <<EOF # mkpasswd is a bit of a hassle, but check to see if it's there
modify sysdba -pw $NewPasswd if [ -z "$NewPasswd" ]
EOF then
if [ -f /usr/bin/mkpasswd ]
then
NewPasswd=`/usr/bin/mkpasswd -l 8`
fi
fi
# So we failed to generate a new password, so keep the original
# installed one.
if [ -z "$NewPasswd" ]
then
NewPasswd="masterkey"
fi
writeNewPassword $NewPasswd
changeInitPassword "$NewPasswd" changeInitPassword "$NewPasswd"
} }
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Change sysdba password - this routine is interactive and is only # Change sysdba password - this routine is interactive and is only
# used in the install shell script not the rpm one. # used in the install shell script not the rpm one.
@ -102,11 +151,12 @@ askUserForNewDBAPassword() {
NewPasswd=$Answer NewPasswd=$Answer
if [ ! -z "$NewPasswd" ] if [ ! -z "$NewPasswd" ]
then then
$IBBin/gsec -user sysdba -password $OrigPasswd <<EOF $FBBin/gsec -user sysdba -password $OrigPasswd <<EOF
modify sysdba -pw $NewPasswd modify sysdba -pw $NewPasswd
EOF EOF
echo "" echo ""
writeNewPassword $NewPasswd
changeInitPassword "$NewPasswd" changeInitPassword "$NewPasswd"
fi fi
@ -134,8 +184,9 @@ changeDBAPassword() {
#= Main Post =============================================================== #= Main Post ===============================================================
IBRootDir=@prefix@ FBRootDir=@prefix@
IBBin=$IBRootDir/bin FBBin=$FBRootDir/bin
RunUser=root
InteractiveInstall=true InteractiveInstall=true
export InteractiveInstall export InteractiveInstall

View File

@ -0,0 +1,186 @@
#!/bin/sh
#
# This library is part of the Firebird 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: changeGdsLibraryCompatibleLink.sh.in,v 1.1 2005-03-13 16:04:59 alexpeshkoff Exp $
#
# This script allows the user to change the link on classic for the
# client library from
#
# a) libfbembed.so original classic direct connection
# b) libfbclient.so multithreaded client connection
#
#------------------------------------------------------------------------
# Prompt for response, store result in Answer
Answer=""
AskQuestion() {
Test=$1
DefaultAns=$2
echo -n "${1}"
Answer="$DefaultAns"
read Answer
if [ -z $Answer ]
then
Answer=$DefaultAns
fi
}
#------------------------------------------------------------------------
# remove Link
removeLink() {
fileName=$1
if [ -L $fileName ]
then
rm -f $fileName
fi
}
#------------------------------------------------------------------------
# quitIfRealFile
# Remove the backward comparibility links for libgds.so
quitIfRealFile() {
fileToCheck=$1
# Don't worry about symbolic links
if [ -L $fileToCheck ]
then
return
fi
if [ -f $fileToCheck ]
then
echo "The file $fileToCheck is a real file not just a link to an "
echo "existing file. It therefore may be from a"
echo "previous firebird or InterBase(r) installation"
echo "You will need to manually check the status of this file"
echo "and remove it before running this script again"
exit
fi
}
#------------------------------------------------------------------------
# removeLinks
# Remove the backward comparibility links for libgds.so
removeLinks() {
removeLink @libdir@/libgds.so
removeLink @libdir@/libgds.so.0
}
#------------------------------------------------------------------------
# createLinksForBackCompatibility
# Create links for back compatibility to InterBase and Firebird1.0
# linked systems.
createLinksForBackCompatibility() {
# 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.
newLibrary=$FBRootDir/lib/$1
removeLinks
ln -s $newLibrary @libdir@/libgds.so
ln -s $newLibrary @libdir@/libgds.so.0
}
#------------------------------------------------------------------------
# printStatus
printStatus() {
printStatus=`ls -l @libdir@/libgds.so | sed 's@^.* /usr@/usr@'`
echo $printStatus
}
#= Main ====================================================================
FBRootDir=@prefix@
FBBin=$FBRootDir/bin
cat <<EOF
For classic server there are two optional backward compatible client libraries.
These are libfbclient.so and libfbembed.so.
libfbclient.so) enables your client to be multithreaded but must connect to a
database via a server.
libfbembed.so) allows the client to directly open the database file, but does
not support multithreaded access
Your current setting is:
EOF
printStatus
echo ""
quitIfRealFile @libdir@/libgds.so
quitIfRealFile @libdir@/libgds.so.0
AskQuestion "Which option would you like to choose (client|embed|remove) [client] " "client"
case $Answer in
embed)
createLinksForBackCompatibility libfbembed.so
;;
client)
createLinksForBackCompatibility libfbclient.so
;;
remove)
removeLinks
;;
*)
echo "Unknown option $Answer chosen"
;;
esac

View File

@ -0,0 +1,161 @@
#! /bin/sh
#
# This library is part of the Firebird 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@firebirdsql.org>
#
# Contributor(s):
#
#
#------------------------------------------------------------------------
# Prompt for response, store result in Answer
Answer=""
AskQuestion() {
Test=$1
DefaultAns=$2
echo -n "${1}"
Answer="$DefaultAns"
read Answer
}
#------------------------------------------------------------------------------
# appendAliasEntry
# check to see if an entry already exists in the aliases.conf file
# if it doesn't append it to the end of the file
appendAliasEntry() {
aliasName=$1
newDB=$2
# check if aliasName already exists
oldLine=`grep "^$aliasName" $AliasFile`
if [ -z $oldLine ]
then
# Create the alias file entry
echo "$aliasName = $newDB" >> $AliasFile
else
cat <<EOF
The alias name $aliasName already exists in $AliasFile
with value:
$oldLine
A new entry will not be created and the existing one will be used.
EOF
AskQuestion "Press return to continue or ^C to abort"
fi
}
#------------------------------------------------------------------------------
# checkNameStartsWithSlash
#
checkNameStartsWithSlash() {
name=$1
letter=`echo $name | cut -c1`
if [ $letter != "/" ]
then
cat <<EOF
The file name "$name" needs to be an absolute path to the file not a
relative path.
Possibly you want: `pwd`/$name
for the path name.
EOF
exit
fi
}
#------------------------------------------------------------------------------
# checkAccessToFile
# This routine should check that the firebird user has
# access to the file if it exists or the directory if it
# does not.
checkAccessToFile() {
fileName=$1
dirName=`dirname $fileName`
echo $fileName
echo $dirName
userName=`id -un`
if [ $userName = "root" ]
then
result=`su firebird -c " if [ -w $dirName ]; then echo 'Ok'; fi"`
fi
}
#= Main Post ===============================================================
FBRootDir=@prefix@
FBBin=$FBRootDir/bin
if [ $# -ne 2 ]
then
echo "Usage is createAliasDB.sh <name> <newDB>"
exit
fi
aliasName=$1
newDB=$2
AliasFile=$FBRootDir/aliases.conf
checkNameStartsWithSlash $newDB
appendAliasEntry $aliasName $newDB
# checkAccessToFile $newDB
if [ ! -f $newDB ]
then
#source $FBRootDir/SYSDBA.password
$FBBin/isql <<EOF
create database 'localhost:$aliasName';
quit;
EOF
fi

View File

@ -19,7 +19,7 @@ FIREBIRD=@prefix@
ISC_USER=SYSDBA ISC_USER=SYSDBA
ISC_PASSWORD=masterke ISC_PASSWORD=masterke
FBRunUser=firebird FBRunUser=firebird
FB_OPTS=-start -forever FB_OPTS="-start -forever"
# WARNING: in a real-world installation, you should not put the # WARNING: in a real-world installation, you should not put the
# SYSDBA password in a publicly-readable file. # SYSDBA password in a publicly-readable file.
# Eventually this file should not need to contain any passwords. # Eventually this file should not need to contain any passwords.

View File

@ -42,6 +42,7 @@ case "$1" in
daemon --user $FBRunUser $FIREBIRD/bin/fbmgr -start -forever daemon --user $FBRunUser $FIREBIRD/bin/fbmgr -start -forever
RETVAL=$? RETVAL=$?
echo
;; ;;
stop) stop)
echo -n "Stopping Firebird server: " echo -n "Stopping Firebird server: "

View File

@ -79,7 +79,7 @@ rc_reset
# considered a success. # considered a success.
case "$1" in case "$1" in
start) start)
echo -n "Starting Firebird" echo -n "Starting Firebird"
## Start daemon with startproc(8). If this fails ## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate. ## the echo return value is set appropriate.
@ -91,7 +91,7 @@ case "$1" in
# Remember status and be verbose # Remember status and be verbose
rc_status -v rc_status -v
;; ;;
stop) stop)
echo -n "Shutting down Firebird" echo -n "Shutting down Firebird"
## Stop daemon with killproc(8) and if this fails ## Stop daemon with killproc(8) and if this fails
## set echo the echo return value. ## set echo the echo return value.
@ -102,16 +102,16 @@ case "$1" in
# as root user alone should be sufficient privledge to stop/start # as root user alone should be sufficient privledge to stop/start
# the server. # the server.
: ${ISC_USER:=SYSDBA} ISC_USER=SYSDBA
: ${ISC_PASSWORD:=masterkey} ISC_PASSWORD=masterkey
$FIREBIRD/bin/fbmgr -shut -user $ISC_USER -password $ISC_PASSWORD 2>/dev/null $FIREBIRD/bin/fbmgr -shut -user $ISC_USER -password $ISC_PASSWORD 2>/dev/null
unset ISC_USER unset ISC_USER
unset ISC_PASSWORD unset ISC_PASSWORD
# Remember status and be verbose # Remember status and be verbose
rc_status -v rc_status -v
;; ;;
try-restart) try-restart)
## Stop the service and if this succeeds (i.e. the ## Stop the service and if this succeeds (i.e. the
## service was running before), start it again. ## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5) ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
@ -120,7 +120,7 @@ case "$1" in
# Remember status and be quiet # Remember status and be quiet
rc_status rc_status
;; ;;
restart|force-reload) restart|force-reload)
## Stop the service and regardless of whether it was ## Stop the service and regardless of whether it was
## running or not, start it again. ## running or not, start it again.
echo "Restarting service Firebird" echo "Restarting service Firebird"
@ -130,10 +130,10 @@ case "$1" in
# Remember status and be quiet # Remember status and be quiet
rc_status rc_status
;; ;;
reload) reload)
;; ;;
status) status)
echo -n "Checking for Firebird: " echo -n "Checking for Firebird: "
## Check status with checkproc(8), if process is running ## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0. ## checkproc will return with exit status 0.
@ -149,7 +149,7 @@ case "$1" in
rc_status -v rc_status -v
;; ;;
*) *)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1 exit 1
;; ;;

View File

@ -2,6 +2,7 @@
# This shell script changes both the SYSDBA user # This shell script changes both the SYSDBA user
# and /etc/init.d/firebird script
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Prompt for response, store result in Answer # Prompt for response, store result in Answer
@ -24,12 +25,20 @@ AskQuestion() {
changeInitPassword() { changeInitPassword() {
NewPasswd=$1 NewPasswd=$1
DBAPasswordFile=$FBRootDir/SYSDBA.password
InitFile=/etc/rc.d/init.d/firebird InitFile=/etc/rc.d/init.d/firebird
if [ ! -f $InitFile ]
then
InitFile=/etc/init.d/firebird
fi
if [ -f $InitFile ] if [ -f $InitFile ]
then then
ed $InitFile <<EOF echo ""
/ISC_PASSWORD/s/ISC_PASSWORD:=.*\}/ISC_PASSWORD:=$NewPasswd\}/g echo Running ex to modify /etc/init.d/firebird
ex $InitFile <<EOF
/ISC_PASSWORD/s/ISC_PASSWORD=.*/ISC_PASSWORD=$NewPasswd/g
w w
q q
EOF EOF
@ -38,43 +47,10 @@ EOF
fi fi
} }
#------------------------------------------------------------------------
# Generate new sysdba password
generateNewDBAPassword() {
DBAPasswordFile=$IBRootDir/SYSDBA.password
NewPasswd=`mkpasswd -l 8`
echo "Firebird generated password " > $DBAPasswordFile
echo "for user SYSDBA is : $NewPasswd" >> $DBAPasswordFile
echo "generated on `hostname` at time `date`" >> $DBAPasswordFile
echo "" >> $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/gsec program as show below:" >> $DBAPasswordFile
echo "" >> $DBAPasswordFile
echo ">cd @prefix@" >> $DBAPasswordFile
echo ">bin/gsec -user sysdba -password <password>" >> $DBAPasswordFile
echo "GSEC>modify sysdba -pw <newpassword>" >> $DBAPasswordFile
echo "GSEC>quit" >> $DBAPasswordFile
chmod u=rw,go= $DBAPasswordFile
$IBBin/gsec -user sysdba -password masterkey <<EOF
modify sysdba -pw $NewPasswd
EOF
changeInitPassword "$NewPasswd"
}
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Change sysdba password - this routine is interactive and is only # this routine is interactive and is only
# used in the install shell script not the rpm one. # used in the install shell script not the rpm one.
@ -85,7 +61,6 @@ askUserForNewDBAPassword() {
do do
AskQuestion "Please enter current password for SYSDBA user: " AskQuestion "Please enter current password for SYSDBA user: "
OrigPasswd=$Answer OrigPasswd=$Answer
done done
NewPasswd="" NewPasswd=""
@ -96,7 +71,7 @@ askUserForNewDBAPassword() {
NewPasswd=$Answer NewPasswd=$Answer
if [ ! -z "$NewPasswd" ] if [ ! -z "$NewPasswd" ]
then then
$IBBin/gsec -user sysdba -password $OrigPasswd <<EOF $FBBin/gsec -user sysdba -password $OrigPasswd <<EOF
modify sysdba -pw $NewPasswd modify sysdba -pw $NewPasswd
EOF EOF
echo "" echo ""
@ -114,25 +89,12 @@ EOF
# used in the install shell script not the rpm one. # used in the install shell script not the rpm one.
changeDBAPassword() {
if [ -z "$InteractiveInstall" ]
then
generateNewDBAPassword
else
askUserForNewDBAPassword
fi
}
#= Main Post =============================================================== #= Main Post ===============================================================
IBRootDir=@install@ FBRootDir=@prefix@
IBBin=$IBRootDir/bin FBBin=$FBRootDir/bin
RunUser=root
InteractiveInstall=true askUserForNewDBAPassword
export InteractiveInstall
changeDBAPassword

View File

@ -0,0 +1,86 @@
#! /bin/sh
#
# 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@firebirdsql.org>
#
# Contributor(s):
#
# $Id: fb_config.in,v 1.1 2005-03-13 16:02:12 alexpeshkoff Exp $
#
# stored configuration values
fb_root=@prefix@
fb_bindir=$fb_root/bin
fb_libdir=$fb_root/lib
fb_incdir=$fb_root/include
fb_cflags="-I$fb_incdir"
fb_libs="-L$fb_libdir -lfbclient"
fb_embedlibs="-L$fb_libdir -lfbembed"
BuildVersion=@FIREBIRD_VERSION@.@FB_BUILD_NUM@
PackageVersion=@FIREBIRD_PACKAGE_VERSION@
CpuType=@CPU_TYPE@
Version="$BuildVersion-$PackageVersion.$CpuType"
fb_version=$Version
usage() {
cat <<EOF
Usage $0 [Options]
Where Options are:
--cflags
--libs
--embedlibs
--bindir
--version
EOF
}
if test "$#" -eq 0 ; then
usage
exit 1
fi
while test $# -gt 0
do
case "$1" in
--cflags) echo $fb_cflags ;;
--libs) echo $fb_libs ;;
--embedlibs) echo $fb_embedlibs ;;
--bindir) echo $fb_bindir ;;
--version) echo $fb_version ;;
--help) usage ;;
*) usage ;
esac
shift
done