Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7a907292e0a486d61b24d89b0b404ac6c793ac8a (plain) (blame)
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
#!/bin/bash -x

#*******************************************************************************
# Copyright (c) 2018 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
#     Sravan Lakkimsetti - initial API and implementation
#*******************************************************************************

if [ $# -ne 1 ]; then
  echo USAGE: $0 env_file
  exit 1
fi

source "../common/common-functions.shsource"

shEnvFile=$(basename $1)
buildDir=$(dirname $1)
baseEnvFile=$(echo $shEnvFile |cut -d. -f1)
phpEnvFile=$(echo $baseEnvFile.php)
propEnvFile=$(echo $baseEnvFile.properties)

BUILD_ENV_FILE=${buildDir}/${shEnvFile}
BUILD_ENV_FILE_PHP=${buildDir}/${phpEnvFile}
BUILD_ENV_FILE_PROP=${buildDir}/${propEnvFile}

fn-addToPropFiles ()
{
	echo "export $1=$2" >> $BUILD_ENV_FILE
	echo "\$$1 = $2;" >> $BUILD_ENV_FILE_PHP
	echo "$1 = $2" >> $BUILD_ENV_FILE_PROP
}
while read propLine
do
	if [[ ${propLine:0:1} == "#" ]]
	then 
		continue
	else
		key=$(echo $propLine|cut -d= -f1)
		value=$(echo $propLine|cut -d= -f2-)
		if [[ -z $key ]]
		then 
			continue
		fi
		fn-addToPropFiles $key "$value"
	fi
done < ../buildproperties.txt

Back to the top