Debian Codegraph @

builds/install/arch-specific/aix/classic/makeInstallImage.sh.in

raw
1 #!/bin/sh
2 # This library is part of the FirebirdSQL project
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 # You may obtain a copy of the Licence at
9 # http://www.gnu.org/licences/lgpl.html
10 #
11 # As a special exception this file can also be included in modules
12 # with other source code as long as that source code has been
13 # released under an Open Source Initiative certificed licence.
14 # More information about OSI certification can be found at:
15 # http://www.opensource.org
16 #
17 # This module is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU Lesser General Public Licence for more details.
21 #
22 # This module was created by members of the firebird development
23 # team. All individual contributions remain the Copyright (C) of
24 # those individuals and all rights are reserved. Contributors to
25 # this file are either listed below or can be obtained from a CVS
26 # history command.
27 #
28 # Created by: Mark O'Donohue <[email protected]>
29 #
30 # Contributor(s):
31 #
32 #
33
34 # Script to copy install files from the build/transport area
35
36
37 # This script builds an image of the installed system into
38 # the gen/buildroot directory.
39
40
41 # Making an assumption that this program is being run in the gen directory
42 BuildRootDir=..
43 BuiltFBDir=./firebird # Where the just built fb exists.
44
45 TargetDir=buildroot # Where we want to build the install image
46
47 RealRootDir=@prefix@ # Where it will be installed on new machine
48 FBRootDir=${RealRootDir#/} # strip off leading /
49 DestDir=$TargetDir/$FBRootDir
50
51
52 #------------------------------------------------------------------------
53 # addLibs
54 # Add required libraries in the beginning of the script
55 # Place it to target directory
56
57 addLibs() {
58 libSdir=$1
59 libScript=$2
60 libTdir=$3
61 libTarget=$libTdir/$libScript
62
63 rm -f $libTarget
64 touch $libTarget
65 for i in posixLibrary.sh classicLibrary.sh aixLibrary.sh
66 do
67 echo "# $i" >>$libTarget
68 cat $libSdir/$i >>$libTarget
69 echo "" >>$libTarget # avoid missing linefeed
70 done
71 cat $libSdir/$libScript >>$libTarget
72 }
73
74
75 #-------------------------------------------------------------------
76 # copyIfExists
77 # Copy file if it exists
78 #
79
80 copyIfExists() {
81 OldFile=$1
82 NewFile=$2
83
84 if [ -f $OldFile ]
85 then
86 cp $OldFile $NewFile
87 fi
88
89 }
90
91
92 #------------------------------------------------------------------------
93 # copyFiles
94 # This function copies all the files for a classic distribution into a
95 # directory heirachy mirroring the installation.
96
97 copyFiles() {
98 # The guts of the tranfer of files and other directories
99
100 if [ -d $TargetDir ]
101 then
102 rm -fr $TargetDir
103 fi
104 mkdir -p $DestDir
105 mkdir $DestDir/bin
106 mkdir $DestDir/examples
107 mkdir $DestDir/help
108 mkdir $DestDir/include
109 mkdir $DestDir/intl
110 mkdir $DestDir/lib
111 mkdir $DestDir/doc
112 mkdir $DestDir/doc/sql.extensions
113 mkdir $DestDir/UDF
114 mkdir $DestDir/misc
115 mkdir $DestDir/misc/upgrade
116 for i in metadata security; do
117 mkdir $DestDir/misc/upgrade/$i
118 done
119
120 mkdir -p $TargetDir@libdir@
121 if [ "$1" != "install-embedded" ]
122 then
123 mkdir -p $TargetDir/usr/include
124 fi
125 cp -f $BuiltFBDir/bin/fb_smp_server $DestDir/bin/fb_smp_server
126
127 cp $BuiltFBDir/bin/gbak $DestDir/bin/gbak
128 cp $BuiltFBDir/bin/gds_drop $DestDir/bin/gds_drop
129 copyIfExists $BuiltFBDir/bin/fb_lock_mgr $DestDir/bin/fb_lock_mgr
130 copyIfExists $BuiltFBDir/bin/fb_lock_print $DestDir/bin/fb_lock_print
131 copyIfExists $BuiltFBDir/bin/gds_pipe $DestDir/bin/gds_pipe
132 cp $BuiltFBDir/bin/gfix $DestDir/bin/gfix
133 cp $BuiltFBDir/bin/gpre $DestDir/bin/gpre
134 cp $BuiltFBDir/bin/gsec $DestDir/bin/gsec
135 cp $BuiltFBDir/bin/nbackup $DestDir/bin/nbackup
136 copyIfExists $BuiltFBDir/bin/gsplit $DestDir/bin/gsplit
137 cp $BuiltFBDir/bin/gstat $DestDir/bin/gstat
138 copyIfExists $BuiltFBDir/bin/isc4.gbak $DestDir/bin/isc4.gbak
139 cp $BuiltFBDir/bin/isql $DestDir/bin/isql
140 cp $BuiltFBDir/bin/qli $DestDir/bin/qli
141
142 # Append libraries to scripts
143 addLibs $BuiltFBDir/bin changedbapassword.aix.sh $DestDir/bin
144 addLibs $BuiltFBDir/bin changegdslibrarycompatiblelink.aix.sh $DestDir/bin
145 addLibs $BuiltFBDir/bin tarmaininstall.aix.sh $BuildRootDir/gen/install/scripts
146 addLibs $BuiltFBDir/bin tarinstall.aix.sh $BuildRootDir/gen/install/scripts
147 addLibs $BuiltFBDir/bin preinstall.aix.sh $BuildRootDir/gen/install/scripts
148 addLibs $BuiltFBDir/bin postinstall.aix.sh $BuildRootDir/gen/install/scripts
149 addLibs $BuiltFBDir/bin preuninstall.aix.sh $BuildRootDir/gen/install/scripts
150 addLibs $BuiltFBDir/bin postuninstall.aix.sh $BuildRootDir/gen//install/scripts
151 addLibs $BuiltFBDir/bin taruninstall.aix.sh $BuildRootDir/gen/install/scripts
152 addLibs $BuiltFBDir/bin tarmainuninstall.aix.sh $BuildRootDir/gen/install/scripts
153
154 # These scripts do not need libraries
155 cp $BuildRootDir/gen/firebird/bin/createaliasdb.aix.sh $DestDir/bin
156 cp $BuiltFBDir/bin/fb_config $DestDir/bin
157
158 cp $BuildRootDir/gen/install/misc/firebird.init.d.aix $DestDir/misc
159 cp $BuildRootDir/gen/install/misc/rc.config.firebird.aix $DestDir/misc
160
161 # Copy examples only if we have them
162
163 if [ -f "$BuiltFBDir/examples/README" ]
164 then
165 (cd $BuiltFBDir/examples; tar cf - .) | (cd $DestDir/examples; tar xf -)
166 else
167 echo "Example files have not been built!"
168 fi
169
170 copyIfExists $BuiltFBDir/help/help.gbak $DestDir/help
171 cp $BuiltFBDir/help/help.fdb $DestDir/help
172
173 #cp -r $BuildSrcDir/doc $DestDir
174 #cp -r $BuiltFBDir/doc $DestDir
175
176 cp $BuiltFBDir/firebird.msg $DestDir/firebird.msg
177 cp $BuiltFBDir/$SecurityDatabase $DestDir/$SecurityDatabase
178
179 cp $BuiltFBDir/include/*.h $DestDir/include
180
181 # files in lib directory are a mix of .a and .so*
182 ((cd $BuiltFBDir/lib; tar cf - *.so*) | (cd $DestDir/lib; tar xf -))
183 ((cd $BuiltFBDir/lib; tar cf - *.a) | (cd $DestDir/lib; tar xf -))
184
185 cp $BuiltFBDir/intl/libfbintl.so $DestDir/intl/fbintl
186
187 # Note that the following items copy files from outside the build tree
188
189 # Copy various documentation
190 ls $BuildRootDir/doc/*.pdf >/dev/null 2>&1 && cp $BuildRootDir/doc/*.pdf $DestDir/doc
191 cp $BuildRootDir/doc/sql.extensions/README* $DestDir/doc/sql.extensions
192 cp $BuildRootDir/*.md $DestDir
193
194 # Copy various upgrade stuff
195 cp $BuildRootDir/src/misc/intl.sql $DestDir/misc/
196 cp $BuildRootDir/src/misc/upgrade/v3.0/security_database* $DestDir/misc/upgrade/security/
197
198 # Misc config files
199 cp $BuildRootDir/gen/install/misc/firebird.conf $DestDir/
200 cp $BuildRootDir/gen/install/misc/databases.conf $DestDir/
201 cp $BuildRootDir/gen/install/misc/fbintl.conf $DestDir/intl/
202
203 # Create links from @libdir@ to install area.
204 if [ "$1" != "install-embedded" ]
205 then
206 echo WE SHOULD NOT BE HERE
207 origDir=`pwd`
208 cd $DestDir/lib
209 for i in libfb*.so*; do ln -s /$FBRootDir/lib/$i $origDir/$TargetDir@libdir@/$i; done
210 cd $origDir
211 ln -s /$FBRootDir/lib/libib_util.so $TargetDir@libdir@/libib_util.so
212
213 # Link include files to /usr/include
214 for i in iberror.h ibase.h ib_util.h; do
215 ln -s ../../$FBRootDir/include/$i $TargetDir/usr/include/$i
216 done
217 fi
218 }
219
220
221
222 #=== MAIN ====================================================================
223
224 SecurityDatabase=security2.fdb
225
226 copyFiles $@