-
Notifications
You must be signed in to change notification settings - Fork 3
/
autogen.sh
executable file
·60 lines (49 loc) · 2.46 KB
/
autogen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#/bin/bash -X
# Search & replace in a file - _replace($find, $replace, $file)
Replace() {
string=''
if [ "$2" != "undef" ];
then
string=$2
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*)
sed -e "s:$1:$string:g" $3 > "/tmp/$$.tmp" || _die "Failed for search and replace '$1' with '$string' in $3"
mv /tmp/$$.tmp $3 || _die "Failed to move /tmp/$$.tmp to $3"
;;
Darwin*)
sed "s:$1:$string:g" $3 > "/tmp/$$.tmp" || _die "Failed for search and replace '$1' with '$string' in $3"
mv /tmp/$$.tmp $3 || _die "Failed to move /tmp/$$.tmp to $3"
;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw
sed "s:$1:$string:g" $3 > "/tmp/$$.tmp" || _die "Failed for search and replace '$1' with '$string' in $3"
mv /tmp/$$.tmp $3 || _die "Failed to move /tmp/$$.tmp to $3"
;;
*) machine="UNKNOWN:${unameOut}"
esac
}
source ./installer-properties.sh
# Create a copy of the PGInstaller.xml.in as PGInstaller.xml
# for BitRockInstallBuilder and replace values in the xml
# file as specified in installer-properties.sh.
if [ -f PGInstaller.xml ];
then
rm -vf PGInstaller.xml || echo "Error removing PGInstaller.xml"
fi
cp PGInstaller.xml.in PGInstaller.xml || echo "Error creating installer.xml"
cp Installer_scripts/postgresql.service Installer_scripts/postgresql-$__PG_MAJOR_VERSION__.service
Replace __PG_MAJOR_VERSION__ $__PG_MAJOR_VERSION__ Installer_scripts/postgresql-$__PG_MAJOR_VERSION__.service || (echo "Error setting PG major version in postgresql-$__PG_MAJOR_VERSION__.service" && exit 1)
Replace __PG_MAJOR_VERSION__ $__PG_MAJOR_VERSION__ PGInstaller.xml || (echo "Error setting PG major version in PGInstaller.xml" && exit 1)
Replace __FULL_VERSION__ $__FULL_VERSION__ PGInstaller.xml || (echo "Error setting PG full version in PGInstaller.xml" && exit 1)
Replace __EXTRA_VERSION_STRING__ $__EXTRA_VERSION_STRING__ PGInstaller.xml || (echo "Error setting extra version string in PGInstaller.xml" && exit 1)
Replace __BUILD_NUMBER__ $__BUILD_NUMBER__ PGInstaller.xml || (echo "Error setting build number in PGInstaller.xml" && exit 1)
Replace __DEBUG__ $__DEBUG__ PGInstaller.xml || (echo "Error setting debug parameter in PGInstaller.xml" && exit 1)
if [ "$__RELEASE__" = "1" ];
then
Replace __DEV_TEST__ "" PGInstaller.xml || (echo "Error setting dev prefix in PGInstaller.xml" && exit 1)
else
Replace __DEV_TEST__ $__DEV_TEST__ PGInstaller.xml || (echo "Error setting dev prefix in PGInstaller.xml" && exit 1)
fi
echo "Completed succssfully"