|
a/codesys-ide/codesyscontrol |
|
b/codesys-ide/codesyscontrol |
1 |
#!/bin/bash |
1 |
#!/bin/bash |
2 |
|
2 |
|
|
|
3 |
# set timeout in seconds |
|
|
4 |
TIMEOUT=60 |
|
|
5 |
|
3 |
if [ -z $1 ]; then |
6 |
if [ -z $1 ]; then |
4 |
echo "usage: $0 <filename of offline bootproject (*.app)> [<artifact 1> <artifact 2>]" |
7 |
echo "usage: $0 <filename of offline bootproject (*.app)> [<artifact 1> <artifact 2>]" |
5 |
exit -1 |
8 |
exit -1 |
6 |
fi |
9 |
fi |
7 |
|
10 |
|
8 |
# create temporary working directory |
11 |
# create temporary working directory |
9 |
tmpdir=$(mktemp -d) |
12 |
tmpdir=$(mktemp -d) |
10 |
|
13 |
|
|
|
14 |
# just a hacky workaround for bad test-applications, writing to "C:" ;) |
|
|
15 |
mkdir ${tmpdir}/C: |
|
|
16 |
|
11 |
# create config file |
17 |
# create config file |
12 |
appname=$(basename ${1} .app) |
18 |
appname=$(basename ${1} .app) |
13 |
cp ${appname}.app ${tmpdir}/Application.app |
19 |
cp ${appname}.app ${tmpdir}/Application.app |
14 |
cp ${appname}.crc ${tmpdir}/Application.crc |
20 |
cp ${appname}.crc ${tmpdir}/Application.crc |
15 |
|
21 |
|
|
... |
|
... |
22 |
EOF |
28 |
EOF |
23 |
|
29 |
|
24 |
# run codesys control |
30 |
# run codesys control |
25 |
( |
31 |
( |
26 |
cd ${tmpdir}; |
32 |
cd ${tmpdir}; |
27 |
/opt/codesys/bin/codesyscontrol.bin -d CODESYSControl.cfg; |
33 |
timeout ${TIMEOUT} /opt/codesys/bin/codesyscontrol.bin CODESYSControl.cfg; |
28 |
) |
34 |
) |
29 |
|
35 |
|
|
|
36 |
# copy artifacts |
|
|
37 |
for i in ${@:2}; do |
|
|
38 |
mkdir -p $(dirname ".drone-artifacts/$i") |
|
|
39 |
cp "${tmpdir}/$i" ".drone-artifacts/$i" |
|
|
40 |
done |
|
|
41 |
|
|
|
42 |
|
30 |
# remove temporary working directory |
43 |
# remove temporary working directory |
31 |
[ -d ${tmpdir} ] && rm -rf ${tmpdir} |
44 |
[ -d ${tmpdir} ] && rm -rf ${tmpdir} |