2009-09-14 09:09:55 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Initial
|
|
|
|
# Developer's Public License Version 1.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
|
|
|
# http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed AS IS,
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing rights
|
|
|
|
# and limitations under the License.
|
|
|
|
#
|
|
|
|
# The Original Code was created by Mark O'Donohue
|
|
|
|
# for the Firebird Open Source RDBMS project.
|
|
|
|
#
|
|
|
|
# Copyright (c) Mark O'Donohue <mark.odonohue@ludwig.edu.au>
|
|
|
|
# and all contributors signed below.
|
|
|
|
#
|
|
|
|
# All Rights Reserved.
|
|
|
|
# Contributor(s): ______________________________________.
|
|
|
|
# Alex Peshkoff
|
|
|
|
#
|
|
|
|
|
2016-09-15 14:21:54 +02:00
|
|
|
fb_install_prefix=@prefix@
|
|
|
|
|
2009-09-14 09:09:55 +02:00
|
|
|
# Script to copy install files from the build/transport area
|
|
|
|
|
|
|
|
|
2009-12-04 11:05:41 +01:00
|
|
|
# This script builds an image of the installed system into
|
2009-09-14 09:09:55 +02:00
|
|
|
# the gen/buildroot directory.
|
|
|
|
|
|
|
|
# Making an assumption that this program is being run in the gen directory
|
|
|
|
BuildRootDir=..
|
2011-01-17 18:38:25 +01:00
|
|
|
BuiltFBDir=Release/firebird # Where the just build fb exists.
|
2009-09-14 09:09:55 +02:00
|
|
|
TargetDir=buildroot # Where we want to build the install image
|
2016-03-06 09:32:18 +01:00
|
|
|
SecurityDatabase=security4.fdb
|
2016-04-24 17:09:48 +02:00
|
|
|
TomBuild="@TOMBUILD@"
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# addLibs
|
|
|
|
# Add required libraries in the beginning of script.
|
|
|
|
# Place it to target directory.
|
|
|
|
|
|
|
|
addLibs() {
|
|
|
|
libSdir=$1
|
|
|
|
libScript=$2
|
|
|
|
libTdir=$3
|
|
|
|
libTarget=$libTdir/$libScript
|
|
|
|
|
|
|
|
rm -f $libTarget
|
|
|
|
touch $libTarget
|
2012-05-22 18:49:43 +02:00
|
|
|
echo "#!/bin/sh" >>$libTarget
|
|
|
|
echo >>$libTarget
|
2011-01-17 18:38:25 +01:00
|
|
|
for i in posixLibrary.sh linuxLibrary.sh
|
2009-09-14 09:09:55 +02:00
|
|
|
do
|
|
|
|
echo "# $i" >>$libTarget
|
|
|
|
cat $libSdir/$i >>$libTarget
|
|
|
|
echo "" >>$libTarget # avoid missing linefeed
|
|
|
|
done
|
|
|
|
cat $libSdir/$libScript >>$libTarget
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# copyIfExists
|
|
|
|
# Copy file if it exists
|
|
|
|
#
|
|
|
|
|
|
|
|
copyIfExists() {
|
|
|
|
Files=""
|
|
|
|
while [ ${#} -gt 1 ]; do
|
|
|
|
Files="$Files ${1}"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
NewDir=${1}
|
|
|
|
|
|
|
|
for OldFile in $Files; do
|
|
|
|
if [ -f $OldFile ]; then
|
|
|
|
cp -df $OldFile $NewDir
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# linkFiles
|
|
|
|
# This function creates soft links
|
|
|
|
|
|
|
|
linkFiles() {
|
|
|
|
From=$1
|
|
|
|
Files=$2
|
|
|
|
To=$3
|
|
|
|
Check=$4
|
|
|
|
|
|
|
|
if [ "$To" = "$Check" ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2009-12-04 11:05:41 +01:00
|
|
|
for file in $Files; do
|
2009-09-14 09:09:55 +02:00
|
|
|
ln -s $From/$file $To/$file
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# makeDirs
|
|
|
|
# Make paths, passed as a list in 1st arg
|
|
|
|
|
|
|
|
makeDirs() {
|
|
|
|
Dirs=$1
|
|
|
|
for d in $Dirs; do
|
|
|
|
Dir=${TargetDir}${d}
|
|
|
|
mkdir -p $Dir
|
|
|
|
chmod 0755 $Dir
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-22 18:48:07 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# ReadOnlyTree
|
|
|
|
# Set correct rights to files in given subtree
|
|
|
|
|
|
|
|
ReadOnlyTree() {
|
|
|
|
Tree=$1
|
|
|
|
|
|
|
|
for i in `find ${Tree} -type d -print`
|
|
|
|
do
|
|
|
|
chmod 0755 $i
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in `find ${Tree} -type f -print`
|
|
|
|
do
|
|
|
|
chmod 0644 $i
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-14 09:09:55 +02:00
|
|
|
#------------------------------------------------------------------------
|
|
|
|
# copyFiles
|
|
|
|
# This function copies all the files for a distribution into a
|
|
|
|
# directory heirachy mirroring the installation.
|
|
|
|
|
|
|
|
copyFiles() {
|
|
|
|
# The guts of the tranfer of files and other directories
|
|
|
|
|
|
|
|
#cleanup
|
|
|
|
if [ -d $TargetDir ]
|
2016-04-22 18:48:07 +02:00
|
|
|
then
|
|
|
|
chmod -R +xw $TargetDir
|
2009-09-14 09:09:55 +02:00
|
|
|
rm -fr $TargetDir
|
2009-12-04 11:05:41 +01:00
|
|
|
fi
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
#directories
|
2013-07-17 14:50:16 +02:00
|
|
|
makeDirs "@FB_BINDIR@ @FB_SBINDIR@ @FB_CONFDIR@ @FB_LIBDIR@ @FB_INCDIR@/firebird @FB_DOCDIR@/sql.extensions @FB_UDFDIR@ \
|
|
|
|
@FB_SAMPLEDIR@ @FB_SAMPLEDBDIR@ @FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ \
|
|
|
|
@FB_GUARDDIR@ @FB_PLUGDIR@"
|
2009-09-14 09:09:55 +02:00
|
|
|
|
2016-01-11 15:23:35 +01:00
|
|
|
for i in security; do
|
2009-09-14 09:09:55 +02:00
|
|
|
makeDirs @FB_MISCDIR@/upgrade/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
makeDirs /usr/include
|
|
|
|
|
|
|
|
#bin
|
2009-12-04 11:05:41 +01:00
|
|
|
cp $BuiltFBDir/bin/gbak ${TargetDir}@FB_BINDIR@/gbak
|
|
|
|
cp $BuiltFBDir/bin/gfix ${TargetDir}@FB_BINDIR@/gfix
|
|
|
|
cp $BuiltFBDir/bin/gpre ${TargetDir}@FB_BINDIR@/gpre
|
|
|
|
cp $BuiltFBDir/bin/gsec ${TargetDir}@FB_BINDIR@/gsec
|
|
|
|
cp $BuiltFBDir/bin/nbackup ${TargetDir}@FB_BINDIR@/nbackup
|
2009-09-14 09:09:55 +02:00
|
|
|
copyIfExists $BuiltFBDir/bin/gsplit ${TargetDir}@FB_BINDIR@
|
2009-12-04 11:05:41 +01:00
|
|
|
cp $BuiltFBDir/bin/gstat ${TargetDir}@FB_BINDIR@/gstat
|
2009-09-14 09:09:55 +02:00
|
|
|
copyIfExists $BuiltFBDir/bin/fbsvcmgr ${TargetDir}@FB_BINDIR@
|
|
|
|
copyIfExists $BuiltFBDir/bin/fbtracemgr ${TargetDir}@FB_BINDIR@
|
2009-12-04 11:05:41 +01:00
|
|
|
cp $BuiltFBDir/bin/isql ${TargetDir}@FB_BINDIR@/isql
|
|
|
|
cp $BuiltFBDir/bin/qli ${TargetDir}@FB_BINDIR@/qli
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
chmod 0755 ${TargetDir}@FB_BINDIR@/*
|
|
|
|
|
|
|
|
#sbin
|
2011-01-17 18:38:25 +01:00
|
|
|
cp -f $BuiltFBDir/bin/firebird ${TargetDir}@FB_SBINDIR@/firebird
|
2009-09-14 09:09:55 +02:00
|
|
|
cp -f $BuiltFBDir/bin/fbguard ${TargetDir}@FB_SBINDIR@
|
|
|
|
copyIfExists $BuiltFBDir/bin/fb_lock_print ${TargetDir}@FB_SBINDIR@
|
|
|
|
|
2013-07-17 14:02:44 +02:00
|
|
|
addLibs $BuiltFBDir/bin changeServerMode.sh ${TargetDir}@FB_SBINDIR@
|
2013-09-13 14:27:16 +02:00
|
|
|
cp $BuiltFBDir/bin/registerDatabase.sh ${TargetDir}@FB_SBINDIR@
|
2009-09-14 09:09:55 +02:00
|
|
|
cp $BuiltFBDir/bin/fb_config ${TargetDir}@FB_SBINDIR@
|
2016-09-15 14:21:54 +02:00
|
|
|
addLibs $BuiltFBDir/bin FirebirdUninstall.sh ${TargetDir}@FB_SBINDIR@
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
chmod 0755 ${TargetDir}@FB_SBINDIR@/*
|
|
|
|
chmod 0700 ${TargetDir}@FB_SBINDIR@/*.sh
|
|
|
|
|
2016-09-15 14:21:54 +02:00
|
|
|
#install script
|
|
|
|
addLibs $BuiltFBDir/bin install.sh $BuildRootDir/gen/install
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
#examples - copy only if we have them
|
|
|
|
exampleFiles=`find $BuiltFBDir/examples/README -type f -print`
|
|
|
|
if [ -z "$exampleFiles" ]; then
|
|
|
|
echo "Example files have not been built!"
|
|
|
|
else
|
|
|
|
(cd $BuiltFBDir/examples; tar cf - .) | (cd ${TargetDir}@FB_SAMPLEDIR@; tar xf -)
|
|
|
|
rm -rf ${TargetDir}@FB_SAMPLEDIR@/empbuild
|
|
|
|
|
|
|
|
makeDirs @FB_SAMPLEDBDIR@
|
|
|
|
cp $BuiltFBDir/examples/empbuild/*.fdb ${TargetDir}@FB_SAMPLEDBDIR@
|
|
|
|
|
2016-04-22 18:48:07 +02:00
|
|
|
ReadOnlyTree ${TargetDir}@FB_SAMPLEDIR@
|
2017-06-07 18:40:59 +02:00
|
|
|
chmod 0664 ${TargetDir}@FB_SAMPLEDBDIR@/*.fdb
|
2009-09-14 09:09:55 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
#QLI help
|
|
|
|
copyIfExists $BuiltFBDir/help/help.gbak ${TargetDir}@FB_HELPDIR@
|
|
|
|
cp $BuiltFBDir/help/help.fdb ${TargetDir}@FB_HELPDIR@
|
|
|
|
|
|
|
|
chmod 0444 ${TargetDir}@FB_HELPDIR@/*.fdb
|
2009-12-04 11:05:41 +01:00
|
|
|
|
2009-09-14 09:09:55 +02:00
|
|
|
#message file
|
|
|
|
cp $BuiltFBDir/*.msg ${TargetDir}@FB_MSGDIR@
|
|
|
|
|
|
|
|
chmod 0444 ${TargetDir}@FB_MSGDIR@/*.msg
|
|
|
|
|
|
|
|
#secureDB (access rights will be set at install time)
|
|
|
|
cp $BuiltFBDir/$SecurityDatabase ${TargetDir}@FB_SECDBDIR@
|
|
|
|
|
2015-12-21 18:01:26 +01:00
|
|
|
#include (.h .pas files)
|
2009-09-14 09:09:55 +02:00
|
|
|
cp $BuiltFBDir/include/*.h ${TargetDir}@FB_INCDIR@
|
2013-07-17 14:50:16 +02:00
|
|
|
cp $BuildRootDir/src/include/firebird/*.h ${TargetDir}@FB_INCDIR@/firebird
|
2014-10-16 14:42:47 +02:00
|
|
|
tar -C $BuildRootDir/src/include/firebird -cf - impl | tar -C ${TargetDir}@FB_INCDIR@/firebird -x
|
2015-12-21 18:01:26 +01:00
|
|
|
cp $BuildRootDir/src/include/gen/Firebird.pas ${TargetDir}@FB_INCDIR@/firebird
|
2009-09-14 09:09:55 +02:00
|
|
|
|
2016-04-22 18:48:07 +02:00
|
|
|
ReadOnlyTree ${TargetDir}@FB_INCDIR@
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
#lib
|
|
|
|
cp -df $BuiltFBDir/lib/libfbclient.so* ${TargetDir}@FB_LIBDIR@
|
|
|
|
cp -f $BuiltFBDir/lib/libib_util.so ${TargetDir}@FB_LIBDIR@/libib_util.so
|
|
|
|
|
2016-04-24 17:09:48 +02:00
|
|
|
if [ "$TomBuild" = "Y" ]; then
|
|
|
|
makeDirs @FB_LIBDIR@/.tm
|
|
|
|
cp -df $BuildRootDir/extern/libtommath/.libs/libtommath.so* ${TargetDir}@FB_LIBDIR@/.tm
|
|
|
|
fi
|
|
|
|
|
2009-09-14 09:09:55 +02:00
|
|
|
chmod 0755 ${TargetDir}@FB_LIBDIR@/*.so*
|
|
|
|
|
|
|
|
#plugins
|
2011-01-17 18:38:25 +01:00
|
|
|
(cd $BuiltFBDir/plugins;tar cf - .) | (cd ${TargetDir}@FB_PLUGDIR@; tar xvf -)
|
2009-09-14 09:09:55 +02:00
|
|
|
|
2011-01-17 18:38:25 +01:00
|
|
|
for file in `find ${TargetDir}@FB_PLUGDIR@ -name '*.so*' -print`; do
|
|
|
|
chmod 0755 ${file}
|
|
|
|
done
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
#intl
|
|
|
|
cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl
|
2009-11-03 14:35:19 +01:00
|
|
|
cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
chmod 0755 ${TargetDir}@FB_INTLDIR@/fbintl
|
|
|
|
chmod 0644 ${TargetDir}@FB_INTLDIR@/fbintl.conf
|
|
|
|
|
|
|
|
#UDF
|
|
|
|
cp $BuiltFBDir/UDF/ib_udf.so ${TargetDir}@FB_UDFDIR@
|
|
|
|
cp $BuiltFBDir/UDF/fbudf.so ${TargetDir}@FB_UDFDIR@
|
|
|
|
# Note that the following items copy files from outside the build tree.
|
2009-12-04 11:05:41 +01:00
|
|
|
# Copy the sql-declarations into the UDF-directory
|
2009-09-14 09:09:55 +02:00
|
|
|
cp $BuildRootDir/src/extlib/ib_udf.sql ${TargetDir}@FB_UDFDIR@
|
|
|
|
cp $BuildRootDir/src/extlib/ib_udf2.sql ${TargetDir}@FB_UDFDIR@
|
|
|
|
cp $BuildRootDir/src/extlib/fbudf/fbudf.sql ${TargetDir}@FB_UDFDIR@
|
|
|
|
|
|
|
|
chmod 0755 ${TargetDir}@FB_UDFDIR@/*.so
|
|
|
|
chmod 0644 ${TargetDir}@FB_UDFDIR@/*.sql
|
2009-12-04 11:05:41 +01:00
|
|
|
|
2009-09-14 09:09:55 +02:00
|
|
|
#doc
|
|
|
|
cp $BuildRootDir/doc/*.pdf ${TargetDir}@FB_DOCDIR@
|
|
|
|
cp $BuildRootDir/doc/README.* ${TargetDir}@FB_DOCDIR@
|
|
|
|
cp $BuildRootDir/doc/sql.extensions/README* ${TargetDir}@FB_DOCDIR@/sql.extensions
|
2016-03-26 13:29:44 +01:00
|
|
|
cp $BuildRootDir/*.md ${TargetDir}@FB_CONFDIR@
|
2009-12-04 11:05:41 +01:00
|
|
|
|
2009-09-14 09:09:55 +02:00
|
|
|
for i in `find ${TargetDir}@FB_MISCDIR@ -print`; do
|
|
|
|
if [ -d $i ]; then
|
|
|
|
chmod 0755 $i
|
|
|
|
else
|
|
|
|
chmod 0644 $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
#misc
|
|
|
|
cp $BuildRootDir/src/misc/intl.sql ${TargetDir}@FB_MISCDIR@
|
2016-01-11 15:23:35 +01:00
|
|
|
cp $BuildRootDir/src/misc/upgrade/v3.0/security_database* ${TargetDir}@FB_MISCDIR@/upgrade/security
|
2009-09-14 09:09:55 +02:00
|
|
|
cp $BuildRootDir/gen/install/misc/firebird.init.d.* ${TargetDir}@FB_MISCDIR@
|
|
|
|
cp $BuildRootDir/gen/install/misc/rc.config.firebird ${TargetDir}@FB_MISCDIR@
|
2017-08-04 17:07:10 +02:00
|
|
|
cp $BuildRootDir/gen/install/misc/firebird.service ${TargetDir}@FB_MISCDIR@
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
chmod -R go-rwx ${TargetDir}@FB_MISCDIR@
|
|
|
|
|
|
|
|
#conf
|
2009-11-03 14:35:19 +01:00
|
|
|
cp $BuiltFBDir/firebird.conf ${TargetDir}@FB_CONFDIR@
|
2013-04-08 18:28:05 +02:00
|
|
|
cp $BuiltFBDir/databases.conf ${TargetDir}@FB_CONFDIR@
|
2009-11-30 15:06:39 +01:00
|
|
|
cp $BuiltFBDir/fbtrace.conf ${TargetDir}@FB_CONFDIR@
|
2011-01-17 18:38:25 +01:00
|
|
|
cp $BuiltFBDir/plugins.conf ${TargetDir}@FB_CONFDIR@
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
chmod 0644 ${TargetDir}@FB_CONFDIR@/*.conf
|
|
|
|
|
2011-10-06 14:19:54 +02:00
|
|
|
#license
|
|
|
|
cp $BuildRootDir/builds/install/misc/*License.txt ${TargetDir}@FB_CONFDIR@
|
|
|
|
|
|
|
|
chmod 0444 ${TargetDir}@FB_CONFDIR@/*License.txt
|
|
|
|
|
2009-12-04 11:05:41 +01:00
|
|
|
# link include files to /usr/include
|
2013-07-17 14:50:16 +02:00
|
|
|
linkFiles "@FB_INCDIR@" "firebird iberror.h ibase.h ib_util.h" "${TargetDir}/usr/include" "${TargetDir}@FB_INCDIR@"
|
2009-09-14 09:09:55 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#=== MAIN ====================================================================
|
|
|
|
|
|
|
|
copyFiles
|