Debian Codegraph @

builds/install/arch-specific/hpux/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 hpuxLibrary.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 ib_udf metadata security; do
117 mkdir $DestDir/misc/upgrade/$i
118 done
119
120 mkdir -p $TargetDir@libdir@
121 mkdir -p $TargetDir/usr/include
122
123 cp -f $BuiltFBDir/bin/fb_smp_server $DestDir/bin/fb_smp_server
124
125 cp $BuiltFBDir/bin/gbak $DestDir/bin/gbak
126 cp $BuiltFBDir/bin/gds_drop $DestDir/bin/gds_drop
127 copyIfExists $BuiltFBDir/bin/fb_lock_mgr $DestDir/bin/fb_lock_mgr
128 copyIfExists $BuiltFBDir/bin/fb_lock_print $DestDir/bin/fb_lock_print
129 copyIfExists $BuiltFBDir/bin/gds_pipe $DestDir/bin/gds_pipe
130 cp $BuiltFBDir/bin/gfix $DestDir/bin/gfix
131 cp $BuiltFBDir/bin/gpre $DestDir/bin/gpre
132 cp $BuiltFBDir/bin/gsec $DestDir/bin/gsec
133 cp $BuiltFBDir/bin/nbackup $DestDir/bin/nbackup
134 copyIfExists $BuiltFBDir/bin/gsplit $DestDir/bin/gsplit
135 cp $BuiltFBDir/bin/gstat $DestDir/bin/gstat
136 copyIfExists $BuiltFBDir/bin/isc4.gbak $DestDir/bin/isc4.gbak
137 cp $BuiltFBDir/bin/isql $DestDir/bin/isql
138 cp $BuiltFBDir/bin/qli $DestDir/bin/qli
139
140 # Append libraries to scripts
141 addLibs $BuiltFBDir/bin changedbaPassword.sh $DestDir/bin
142 addLibs $BuiltFBDir/bin changegdslibrarycompatibleLink.sh $DestDir/bin
143
144 addLibs $BuiltFBDir/bin tarmainInstall.sh $BuildRootDir/gen/install/scripts
145 addLibs $BuiltFBDir/bin tarInstall.sh $BuildRootDir/gen/install/scripts
146 addLibs $BuiltFBDir/bin preInstall.sh $BuildRootDir/gen/install/scripts
147 addLibs $BuiltFBDir/bin postInstall.sh $BuildRootDir/gen/install/scripts
148 addLibs $BuiltFBDir/bin preUninstall.sh $BuildRootDir/gen/install/scripts
149 addLibs $BuiltFBDir/bin postUninstall.sh $BuildRootDir/gen//install/scripts
150 addLibs $BuiltFBDir/bin tarUninstall.sh $BuildRootDir/gen/install/scripts
151 addLibs $BuiltFBDir/bin tarmainUninstall.sh $BuildRootDir/gen/install/scripts
152
153 # These scripts do not need libraries
154 cp $BuildRootDir/gen/firebird/bin/createaliasDB.sh $DestDir/bin
155 cp $BuiltFBDir/bin/fb_config $DestDir/bin
156
157 cp $BuildRootDir/gen/install/misc/firebird.init.d.hpux $DestDir/misc
158 cp $BuildRootDir/gen/install/misc/rc.config.firebird.hpux $DestDir/misc
159
160 # Copy examples only if we have them
161
162 if [ -f "$BuiltFBDir/examples/README" ]
163 then
164 (cd $BuiltFBDir/examples; tar cf - .) | (cd $DestDir/examples; tar xf -)
165 else
166 echo "Example files have not been built!"
167 fi
168
169 copyIfExists $BuiltFBDir/help/help.gbak $DestDir/help
170 cp $BuiltFBDir/help/help.fdb $DestDir/help
171
172 #cp -r $BuildSrcDir/doc $DestDir
173 #cp -r $BuiltFBDir/doc $DestDir
174
175 cp $BuiltFBDir/firebird.msg $DestDir/firebird.msg
176 cp $BuiltFBDir/$SecurityDatabase $DestDir/$SecurityDatabase
177
178 cp $BuiltFBDir/include/*.h $DestDir/include
179
180 ((cd $BuiltFBDir/lib; tar cf - *.sl*) | (cd $DestDir/lib; tar xf -))
181
182 cp $BuiltFBDir/intl/libfbintl.sl $DestDir/intl/fbintl
183
184 cp $BuiltFBDir/UDF/ib_udf.sl $DestDir/UDF/
185 cp $BuiltFBDir/UDF/fbudf.sl $DestDir/UDF/
186
187 # Note that the following items copy files from outside the build tree
188
189 # Copy the sql-declarations into the UDF-directory
190 cp $BuildRootDir/src/extlib/ib_udf.sql $DestDir/UDF/
191 cp $BuildRootDir/src/extlib/ib_udf2.sql $DestDir/UDF/
192 cp $BuildRootDir/src/extlib/fbudf/fbudf.sql $DestDir/UDF/
193
194 # Copy various documentation
195 ls $BuildRootDir/doc/*.pdf >/dev/null 2>&1 && cp $BuildRootDir/doc/*.pdf $DestDir/doc
196 cp $BuildRootDir/doc/README.* $DestDir/doc
197 cp $BuildRootDir/doc/sql.extensions/README* $DestDir/doc/sql.extensions
198 cp $BuildRootDir/*.md $DestDir
199
200 # Copy various upgrade stuff
201 cp $BuildRootDir/src/misc/intl.sql $DestDir/misc/
202 cp $BuildRootDir/src/misc/upgrade/v3.0/security_database* $DestDir/misc/upgrade/security/
203
204 # Misc config files
205 cp $BuildRootDir/gen/install/misc/firebird.conf $DestDir/
206 cp $BuildRootDir/gen/install/misc/databases.conf $DestDir/
207 cp $BuildRootDir/gen/install/misc/fbintl.conf $DestDir/intl/
208
209 # Create links from @libdir@ to install area.
210 origDir=`pwd`
211 cd $DestDir/lib
212 for i in libfb*.sl*; do ln -s /$FBRootDir/lib/$i $origDir/$TargetDir@libdir@/$i; done
213 cd $origDir
214 ln -s /$FBRootDir/lib/libib_util.sl $TargetDir@libdir@/libib_util.sl
215
216 # Link include files to /usr/include
217 for i in iberror.h ibase.h ib_util.h; do
218 ln -s ../../$FBRootDir/include/$i $TargetDir/usr/include/$i
219 done
220
221 }
222
223
224
225 #=== MAIN ====================================================================
226
227 SecurityDatabase=security2.fdb
228
229 copyFiles