Blame view

update_amda/generate_param_info 2.68 KB
4c77b9b1   Elena.Budnik   final update
1
2
#!/bin/bash

99ae8744   Benjamin Renard   Use config variab...
3
4
5
6
7
8
SCRIPT=$(readlink -f "$0")
export UPDATEDIR=$(dirname "$SCRIPT")
. $UPDATEDIR/updateEnv.sh

if [[ -z ${NEWMETA+x} || -z ${AMDA_KERNEL_DIR+x} ]]; then 
  echo "[ERROR] check if NEWMETA & AMDA_KERNEL_DIR env variables are defined"
4c77b9b1   Elena.Budnik   final update
9
10
11
12
13
  exit
fi 
   
CRT_PWD=`pwd`

99ae8744   Benjamin Renard   Use config variab...
14
cd $AMDA_KERNEL_DIR/app-generate-paraminfo
4c77b9b1   Elena.Budnik   final update
15
 
99ae8744   Benjamin Renard   Use config variab...
16
17
export PATH=$AMDA_KERNEL_DIR/build/${KERNEL_BUILD_TYPE}/bin:$PATH
export DDPATH=$AMDA_KERNEL_DIR/app-generate-paraminfo
4c77b9b1   Elena.Budnik   final update
18
19
20
21
22
23
24
25
26
27

PARAM_INFO_PATH=$NEWMETA/ParamInfo
if [ ! -d "$PARAM_INFO_PATH" ]; then
	mkdir "$PARAM_INFO_PATH"
fi

# if predefined param info exists - copy it to NEWMETA/ParamInfo 
# to avoid not needed calculations

if  [ -d $AMDAINTERNALDIR/PARAM_INFO_PREDEFINED ]; then
189c51a1   Elena.Budnik   preprocessInfo
28
	cp $AMDAINTERNALDIR/PARAM_INFO_PREDEFINED/info*.xml $PARAM_INFO_PATH
4c77b9b1   Elena.Budnik   final update
29
30
fi

189c51a1   Elena.Budnik   preprocessInfo
31
32
33
34
35
36
37
for param_file in $NEWMETA/final/*.xml
do
    param_filename=$(basename "${param_file%.*}")    
    info_file=info_${param_filename}.xml
    
    if [ -e $PARAM_INFO_PATH/$info_file ]
     then
d23bf7c6   Elena.Budnik   modify param prop...
38
39
       #echo ${param_filename} exists
       temp=a
189c51a1   Elena.Budnik   preprocessInfo
40
41
42
43
44
45
     else
      echo "Generate info file for ${param_filename}"           
      php $UPDATEDIR/preprocessInfo.php ${param_filename}         
    fi
done

4c77b9b1   Elena.Budnik   final update
46
47
48
49
50
51
#modif in app.properties
if [ ! -e ./app.properties ]; then
	echo "No app.properties file !!!"
	exit
fi

68ca1875   Elena.Budnik   rm app.properties...
52
53
54
55
if [ -e ./app.properties.temp ]; then
	rm ./app.properties.temp
fi

d23bf7c6   Elena.Budnik   modify param prop...
56
57
while read line  
	do
4c77b9b1   Elena.Budnik   final update
58
		
d23bf7c6   Elena.Budnik   modify param prop...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
		if [[ $line == app.param.path* ]]; then
			line="app.param.path="$NEWMETA"final/"
		fi
		
		if [[ $line == app.dataSetInfo.path* ]]; then
			line="app.dataSetInfo.path="$NEWMETA"datasets/"
		fi
		
		if [[ $line == app.user.name* ]]; then
			line="app.user.name="$DDUSER
		fi
		
		if [[ $line == app.plugin* ]]; then
			line="app.plugin=./../build/"$KERNEL_BUILD_TYPE"/plugin/"
		fi	
		
		if [[ $line == app.process.LIB* ]]; then
			line="app.process.LIB=-L../build/"$KERNEL_BUILD_TYPE"/lib/ -lParameters"
		fi	
		
		echo $line >> ./app.properties.temp
68ca1875   Elena.Budnik   rm app.properties...
80
	
d23bf7c6   Elena.Budnik   modify param prop...
81
82
83
84
	done < <(cat $AMDA_KERNEL_DIR/app-generate-paraminfo/app.properties)
	
cp  ./app.properties.temp $AMDA_KERNEL_DIR/app-generate-paraminfo/app.properties
#fi 
4c77b9b1   Elena.Budnik   final update
85
86
87
88
89
90
91
92
93
94
95
   
   
DDLogin $DDUSER $DDPASS

for param_file in $NEWMETA/final/*.xml
do
    param_filename=$(basename "${param_file%.*}")    
    info_file=info_${param_filename}.xml
    
    if [ -e $NEWMETA/ParamInfo/$info_file ]
     then
d23bf7c6   Elena.Budnik   modify param prop...
96
97
       # echo ${param_filename} exists
       temp=a
4c77b9b1   Elena.Budnik   final update
98
99
100
101
     else
      echo "Generate info file for ${param_filename}"
      amdaParameterInfo -p ${param_filename}
      if [ $? -eq 0 ]; then
189c51a1   Elena.Budnik   preprocessInfo
102
         mv $info_file  $PARAM_INFO_PATH
4c77b9b1   Elena.Budnik   final update
103
104
      fi
    fi
189c51a1   Elena.Budnik   preprocessInfo
105
done
4c77b9b1   Elena.Budnik   final update
106

61e3eceb   Elena.Budnik   copy param info t...
107
# copy info for parameter arguments
99ae8744   Benjamin Renard   Use config variab...
108
109
if [ ! -d $PARAMS_LOCALINFO_DIR ]; then
	mkdir $PARAMS_LOCALINFO_DIR
61e3eceb   Elena.Budnik   copy param info t...
110
111
fi 

99ae8744   Benjamin Renard   Use config variab...
112
cp $PARAM_INFO_PATH/info*.xml $PARAMS_LOCALINFO_DIR
4c77b9b1   Elena.Budnik   final update
113
114

cd ${CRT_PWD}
61e3eceb   Elena.Budnik   copy param info t...