Blame view

update_amda/updateAmda 3.83 KB
4c77b9b1   Elena.Budnik   final update
1
2
3
4
#!/bin/bash

# --install | -i ; --update-internal | -u ; --with-remote | -r ; --generate-param-args | -a ; -update-param-args | -p ;
# --spase-synchro | -s ; --clean-new-meta | -c ; --help | -h;
2d0ca0ba   Benjamin Renard   Load environment ...
5
6
7

	SCRIPT=$(readlink -f "$0")
	export UPDATEDIR=$(dirname "$SCRIPT")
9ad25dca   Elena.Budnik   relative path
8
	. $UPDATEDIR/updateEnv.sh
4c77b9b1   Elena.Budnik   final update
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

	for option in $@
	do
		case $option in
			--install | -i)  INSTALL=1
			;;
			--update-internal | -u)  UPDATE=1
			;;
			--with-remote | -r)  REMOTE=1 
			;;
			--generate-param-args | -a) PARAM_INFO=1
												 CLEAN_ARGS=1
			;;
			--update-param-args | -p) PARAM_INFO=1											  
			;;
			--spase-synchro | -s) SYNCHRO=1
			;;
			--clean-new-meta | -c) CLEAN_NEWMETA=1
			;;
			--help | -h) echo "updateAmda --install | -i ; --update-internal | -u ; --with-remote | -r ; --generate-param-args | -a ; -update-param-args | -p ; --spase-synchro | -s ; --clean-new-meta | -c ; --help | -h;"							
							 exit
			;;
			*) echo "Invalid option" $option
				exit
			;;
		esac
	done
		
	#Please export DDUSER and DDPASS in the shell !!!!
	if  [ $PARAM_INFO ] && [[ -z ${DDUSER+x}  || -z ${DDPASS+x} ]]
		then 
			echo "Warning : DDUSER and DDPASS should be defined to generate params info"
			echo "No params info generation will be done!!!" 
			unset PARAM_INFO
			#export DDUSER=XXXX
			#export DDPASS=XXXX
	fi
	
	# In the case of SPASE synchro export SPASEUSER
	if [ -z ${SPASEUSER+x} ] && [ $SYNCHRO ]
		then
			echo "SPASEUSER should be defined to SYNCHRO SPASE Registry"
			echo "No SYNHRO wil be done!!!" 
			#export SPASEUSER=XXXX
			unset SYNCHRO 
	fi 
	
	if [ $CLEAN_NEWMETA ]
		then 
			echo "cleaning in NEWMETA.."
			# cleanNewMetaLight
9ad25dca   Elena.Budnik   relative path
60
61
			$UPDATEDIR/cleanNewMetaLight
			$UPDATEDIR/cleanNewMetaParamInfo
4c77b9b1   Elena.Budnik   final update
62
63
64
65
66
67
68
69
70
			echo "clean in NEWMETA : done"
			exit
	fi
		
	if [ $INSTALL ] 
		then
			echo "Installing...."
			
			echo "cleaning in NEWMETA.."
9ad25dca   Elena.Budnik   relative path
71
			$UPDATEDIR/cleanNewMetaLight
4c77b9b1   Elena.Budnik   final update
72
73
			echo "clean in NEWMETA : done"
			
d73734df   Elena.Budnik   add DDBASE Remote...
74
			echo "cleaning in AMDA_IHM/generic_data ..."
9ad25dca   Elena.Budnik   relative path
75
			$UPDATEDIR/cleanExistingInstallation 
d73734df   Elena.Budnik   add DDBASE Remote...
76
			echo "clean in AMDA_IHM/generic_data : done"
4c77b9b1   Elena.Budnik   final update
77
78
79
80
81
82
83
84
85
86
87
			
			echo "making Amda From Spase..."
			if [ $SYNCHRO ]
				then 
					php $AMDA_SPASE_INTERFACE/makeAmdaFromSpase.php "synchro"
				else 
					php $AMDA_SPASE_INTERFACE/makeAmdaFromSpase.php
			fi			
			echo "make Amda From Spase : done"
			
			echo "making Tree..."
9ad25dca   Elena.Budnik   relative path
88
			php $UPDATEDIR/makeTree.php
4c77b9b1   Elena.Budnik   final update
89
90
91
			echo "make Tree : done"
			
			echo "copying 2 amda..."
9ad25dca   Elena.Budnik   relative path
92
			$UPDATEDIR/cp2amda
4c77b9b1   Elena.Budnik   final update
93
94
95
			echo "copy 2 amda : done"	
			
			echo "making Orbits..."
9ad25dca   Elena.Budnik   relative path
96
			$UPDATEDIR/makeOrbits
4c77b9b1   Elena.Budnik   final update
97
			echo "make Orbits : done"
d73734df   Elena.Budnik   add DDBASE Remote...
98
99
			
			echo "copy DDBASE Remote Params descriptions"
99ae8744   Benjamin Renard   Use config variab...
100
101
			if [ -d $RemoteData/PARAMS ]; then
				cp $RemoteData/PARAMS/* $PARAMS_LOCALDB_DIR/
d73734df   Elena.Budnik   add DDBASE Remote...
102
			fi 
4c77b9b1   Elena.Budnik   final update
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
	fi
		# Update StartStop only	
	if [ $UPDATE ]
		then
			echo "Updating...."
			
			if [ $SYNCHRO ]
				then 
					php $AMDA_SPASE_INTERFACE/updateStartStop.php 'synchro'
				else 
					php $AMDA_SPASE_INTERFACE/updateStartStop.php	 
			fi
			
			echo 'update in NEWMETA/dd_missions: done'
			
			echo "making Tree..."
9ad25dca   Elena.Budnik   relative path
119
			php $UPDATEDIR/makeTree.php
4c77b9b1   Elena.Budnik   final update
120
121
			echo "make Tree : done"
 
99ae8744   Benjamin Renard   Use config variab...
122
			if [ -d $LocalData ] && [ -e ./LocalParams.xml ]
4c77b9b1   Elena.Budnik   final update
123
			then
99ae8744   Benjamin Renard   Use config variab...
124
				mv ./LocalParams.xml $LocalData
4c77b9b1   Elena.Budnik   final update
125
126
127
128
			fi
			echo 'copy 2 amda : done'
			
			echo "updating OrbitsInfo..."
99ae8744   Benjamin Renard   Use config variab...
129
			php $AMDA_IHM/php/RemoteDataCenter/makeOrbitsInfo.php
4c77b9b1   Elena.Budnik   final update
130
131
132
133
134
135
136
137
			echo "update OrbitsInfo : done" 
	fi
	
	if [ $PARAM_INFO ] 
		then
			echo "Generating param info...."
			
			if [ $CLEAN_ARGS ]; then 
9ad25dca   Elena.Budnik   relative path
138
				$UPDATEDIR/cleanNewMetaParamInfo
4c77b9b1   Elena.Budnik   final update
139
140
141
142
			fi
			
			generate_param_info
			# copy info for parameter arguments
99ae8744   Benjamin Renard   Use config variab...
143
144
			if [ ! -d $PARAMS_LOCALINFO_DIR ]; then
				mkdir $PARAMS_LOCALINFO_DIR
4c77b9b1   Elena.Budnik   final update
145
146
147
148
			fi 
			
			if [ -d $NEWMETA/ParamInfo ] 
			then 
99ae8744   Benjamin Renard   Use config variab...
149
				cp $NEWMETA/ParamInfo/info*.xml $PARAMS_LOCALINFO_DIR
4c77b9b1   Elena.Budnik   final update
150
151
152
153
154
155
156
157
			fi 
			
			echo "generate info for arguments : done"								
	fi
		 	
	if [ $REMOTE ] 
		then
			echo "making Remote"
9ad25dca   Elena.Budnik   relative path
158
			$UPDATEDIR/makeRemote
4c77b9b1   Elena.Budnik   final update
159
160
			echo "make Remote : done"
	fi
2d0ca0ba   Benjamin Renard   Load environment ...
161