a/scripts/functions.sh b/scripts/functions.sh
...
...
3
COL_DEFAULT='\e[0;00m'
3
COL_DEFAULT='\e[0;00m'
4
COL_BLUE='\e[0;96m'
4
COL_BLUE='\e[0;96m'
5
COL_GREEN='\e[0;92m'
5
COL_GREEN='\e[0;92m'
6
COL_RED='\e[41m'
6
COL_RED='\e[41m'
7
7
8
DOCKER="docker run --rm --dns=192.168.0.11"
8
#DNS="--dns=192.168.0.11"
9
DNS=""
10
11
DOCKER="docker run --rm ${DNS}"
9
if $(groups|grep -qvw docker); then
12
if $(groups|grep -qvw docker); then
10
  # We are not in the docker group, checking if we are sudoers
13
  # We are not in the docker group, checking if we are sudoers
11
  sudo -n true
14
  sudo -n true
12
  if [ $? == 0 ]; then
15
  if [ $? == 0 ]; then
13
    DOCKER="sudo docker run --rm --dns=192.168.0.11"
16
    DOCKER="sudo docker run --rm ${DNS}"
14
  else
17
  else
15
    echo "Not able to execute docker"
18
    echo "Not able to execute docker"
16
    exit -1
19
    exit -1
17
  fi
20
  fi
18
fi
21
fi
22
19
DEV_DOCKER_IMAGE="c2netproject.eu/runtime/java/dev:1_0_0"
23
DEV_DOCKER_IMAGE="c2netproject.eu/runtime/java/dev:1_0_0"
20
MARIA_DOCKER_IMAGE="eslap.cloud/runtime/mariadb:1_0_0"
24
MARIA_DOCKER_IMAGE="eslap.cloud/runtime/mariadb:1_0_0"
21
NPMINSTALL="
25
NPMINSTALL="
22
cd /tmp/component
26
cd /tmp/component
23
while [ ! -f node_modules/.bin/coffee ]; do
27
while [ ! -f node_modules/.bin/coffee ]; do
...
...
91
95
92
  # Validate prepare actions
96
  # Validate prepare actions
93
  if ( [ ${prepare} != "skip-copy-src" ] && [ ${prepare} != "copy-src" ] \
97
  if ( [ ${prepare} != "skip-copy-src" ] && [ ${prepare} != "copy-src" ] \
94
   && [ ${prepare} != "copy-src" ] && [ ${prepare} != "copy-src-pubsub" ] \
98
   && [ ${prepare} != "copy-src" ] && [ ${prepare} != "copy-src-pubsub" ] \
95
   && [ ${prepare} != "copy-src-ucp" ] && [ ${prepare} != "unzip-ucp" ]  \
99
   && [ ${prepare} != "copy-src-ucp" ] && [ ${prepare} != "unzip-ucp" ]  \
100
   && [ ${prepare} != "copy-all" ]   && [ ${prepare} != "copy-src-import-alg-julia" ]  \
96
   && [ ${prepare} != "copy-src-import-alg" ]  && [ ${prepare} != "copy-src-dkms" ] )
101
   && [ ${prepare} != "copy-src-import-alg" ]  && [ ${prepare} != "copy-src-dkms" ] )
97
  then
102
  then
98
    echoError "Invalid prepare action $prepare"
103
    echoError "Invalid prepare action $prepare"
99
    exit -1
104
    exit -1
100
  fi
105
  fi
...
...
153
  then
158
  then
154
    sudo rm -rf ${ComponentPath} || true
159
    sudo rm -rf ${ComponentPath} || true
155
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude=".*" ${componentSrc} ${COMPONENTS_HOME}/
160
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude=".*" ${componentSrc} ${COMPONENTS_HOME}/
156
    echoBlue "$ComponentName Copied to Components Bundle"
161
    echoBlue "$ComponentName Copied to Components Bundle"
157
162
163
  # Copy ALL in component, to avoid to recompile again
164
  elif [ ${prepare} = "copy-all" ]
165
  then
166
    sudo rm -rf ${ComponentPath} || true
167
    rsync -avq --include="Manifest.json" --include="code"  --exclude="test*" --exclude=".*" ${componentSrc} ${COMPONENTS_HOME}/
168
    echoBlue "$ComponentName Copied to Components Bundle with node_modules"
169
158
  # Special case for pubsub, todo change this
170
  # Special case for pubsub, todo change this
159
  elif [ ${prepare} = "copy-src-pubsub" ]
171
  elif [ ${prepare} = "copy-src-pubsub" ]
160
  then
172
  then
161
    sudo rm -rf ${ComponentPath} || true
173
    sudo rm -rf ${ComponentPath} || true
162
    mkdir ${ComponentPath}
174
    mkdir ${ComponentPath}
...
...
177
    mkdir ${ComponentPath}
189
    mkdir ${ComponentPath}
178
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude="module" --exclude=".*" ${componentSrc} ${COMPONENTS_HOME}/
190
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude="module" --exclude=".*" ${componentSrc} ${COMPONENTS_HOME}/
179
    echoBlue "$ComponentName Copied to Components Bundle"
191
    echoBlue "$ComponentName Copied to Components Bundle"
180
192
181
  # Special case for task executor
193
  # Special case for task executor
182
  elif [ ${prepare} = "copy-src-import-alg" ]
194
  elif [ ${prepare} = "copy-src-import-alg-julia" ]
183
  then
195
  then
184
    # check if directory exists
196
    if [ ! -d "$componentSrc/scripts" ]; then
197
      echoError "Folder NOT FOUND $componentSrc/scripts "
198
      exit 1
199
    fi
185
    origin=$PWD
200
    origin=$PWD
186
#    ${componentSrc}/scripts/build_julia_image.sh
201
187
    ${componentSrc}/scripts/import_algorithms.sh false
202
    echoGreen "$ComponentName Copying algorithms"
203
    cd ${componentSrc}/scripts
204
    ./import_algorithms.sh
205
206
    echoGreen "$ComponentName Building Julia image  "
207
    cd ${componentSrc}/scripts
208
    ./build_julia_image.sh
188
    echoBlue "$ComponentName Optimization Algorithms imported"
209
    echoBlue "$ComponentName Optimization Algorithms imported"
189
210
190
    cd ${origin}
211
    cd ${origin}
191
    sudo rm -rf ${ComponentPath} || true
212
    sudo rm -rf ${ComponentPath} || true
192
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude=".*" --exclude="resources" ${componentSrc} ${COMPONENTS_HOME}/
213
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude=".*" --exclude="resources" ${componentSrc} ${COMPONENTS_HOME}/
193
    echoBlue "$ComponentName Copied to Components Bundle"
214
    echoBlue "$ComponentName Copied to Components Bundle"
194
215
216
 # Special case for task executor
217
  elif [ ${prepare} = "copy-src-import-alg" ]
218
  then
219
    if [ ! -d "$componentSrc/scripts" ]; then
220
      echoError "Folder NOT FOUND $componentSrc/scripts "
221
      exit 1
222
    fi
223
    origin=$PWD
224
    cd ${componentSrc}/scripts
225
    ./import_algorithms.sh
226
    echoBlue "$ComponentName Optimization Algorithms imported"
227
228
    cd ${origin}
229
    sudo rm -rf ${ComponentPath} || true
230
    rsync -avq --include="Manifest.json" --include="code" --exclude="node_modules"  --exclude="test*" --exclude=".*" --exclude="resources" ${componentSrc} ${COMPONENTS_HOME}/
231
    echoBlue "$ComponentName Copied to Components Bundle"
195
232
196
  fi
233
  fi
197
}
234
}
198
235
199
function buildComponent() {
236
function buildComponent() {