|
a/codesys-ide/codesys |
|
b/codesys-ide/codesys |
1 |
#!/bin/bash |
1 |
#!/bin/bash |
2 |
|
2 |
|
|
|
3 |
WINE=wine-development |
|
|
4 |
|
3 |
if [ -d /usr/local/share/codesys ]; then |
5 |
if [ -d /usr/local/share/codesys ]; then |
4 |
BASEPATH=/usr/local/share/codesys |
6 |
BASEPATH=/usr/local/share/codesys |
5 |
else |
7 |
else |
6 |
BASEPATH=$(pwd)/scripts |
8 |
BASEPATH=$(pwd)/scripts |
7 |
fi |
9 |
fi |
|
... |
|
... |
12 |
|
14 |
|
13 |
# start ide? |
15 |
# start ide? |
14 |
if [ "${1}" == "ide" ]; then |
16 |
if [ "${1}" == "ide" ]; then |
15 |
export WINEPREFIX=~/.wine.cds |
17 |
export WINEPREFIX=~/.wine.cds |
16 |
export WINEDEBUG=-all |
18 |
export WINEDEBUG=-all |
17 |
wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
19 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI |
18 |
wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" |
20 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" |
19 |
elif [ "${1}" == "export-libdoc" ]; then |
21 |
elif [ "${1}" == "export-libdoc" ]; then |
20 |
export WINEPREFIX=~/.wine.cds |
22 |
export WINEPREFIX=~/.wine.cds |
21 |
export WINEDEBUG=-all |
23 |
export WINEDEBUG=-all |
22 |
export LIBDOC_CODESYS="c:/CODESYS/CODESYS/Common/CODESYS.exe --profile=\"${profile}\"" |
24 |
export LIBDOC_CODESYS="c:/CODESYS/CODESYS/Common/CODESYS.exe --profile=\"${profile}\"" |
|
|
25 |
|
23 |
for i in $(find -iname \*.library); do |
26 |
for i in $(find -iname \*.library); do |
24 |
wine-development ${libdoc} make ${i} html |
27 |
${WINE} ${libdoc} make ${i} html |
25 |
libbase=$(basename $i .library) |
28 |
libbase=$(basename $i .library) |
26 |
libdir=$(dirname $i) |
29 |
libdir=$(dirname $i) |
27 |
if [ -d ${libdir}/${libbase}-html ]; then |
30 |
if [ -d ${libdir}/${libbase}-html ]; then |
28 |
mkdir -p .drone-artifacts/${libdir} |
31 |
mkdir -p .drone-artifacts/${libdir} |
29 |
zip .drone-artifacts/${libdir}/${libbase}.zip ${libdir}/${libbase}-html |
32 |
zip .drone-artifacts/${libdir}/${libbase}.zip ${libdir}/${libbase}-html |
30 |
fi |
33 |
fi |
31 |
done |
34 |
done |
|
|
35 |
elif [ "${1}" == "export-libdoc-pdf" ]; then |
|
|
36 |
export WINEPREFIX=~/.wine.cds |
|
|
37 |
export WINEDEBUG=-all |
|
|
38 |
export LIBDOC_CODESYS="c:/CODESYS/CODESYS/Common/CODESYS.exe --profile=\"${profile}\"" |
|
|
39 |
|
|
|
40 |
for i in $(find -iname \*.library); do |
|
|
41 |
${WINE} ${libdoc} make ${i} chm |
|
|
42 |
libbase=$(basename $i .library) |
|
|
43 |
libdir=$(dirname $i) |
|
|
44 |
if [ -f ${libdir}/${libbase}.pdf ]; then |
|
|
45 |
mkdir -p .drone-artifacts/${libdir} |
|
|
46 |
cp ${libdir}/${libbase}.pdf .drone-artifacts/${libdir}/${libbase}.pdf |
|
|
47 |
fi |
|
|
48 |
done |
32 |
else |
49 |
else |
33 |
|
50 |
|
34 |
# check if file exists, before we call CODESYS with it |
51 |
# check if file exists, before we call CODESYS with it |
35 |
if [ ! -f ${BASEPATH}/${1}.py ]; then |
52 |
if [ ! -f ${BASEPATH}/${1}.py ]; then |
36 |
echo "error: script '${BASEPATH}/${1}.py' not found." |
53 |
echo "error: script '${BASEPATH}/${1}.py' not found." |
|
... |
|
... |
39 |
|
56 |
|
40 |
export DISPLAY=:91 |
57 |
export DISPLAY=:91 |
41 |
Xvfb :91 &> /dev/zero & |
58 |
Xvfb :91 &> /dev/zero & |
42 |
sleep 1 |
59 |
sleep 1 |
43 |
export WINEPREFIX=~/.wine.cds |
60 |
export WINEPREFIX=~/.wine.cds |
44 |
wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
61 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI |
45 |
wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI |
62 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI |
46 |
result=$? |
63 |
result=$? |
47 |
sleep 1 |
64 |
sleep 1 |
48 |
killall Xvfb |
65 |
killall Xvfb |
49 |
rm -rf /tmp/.X* |
66 |
rm -rf /tmp/.X91* |
50 |
|
67 |
|
51 |
if [ "${result}" == "0" ]; then |
68 |
if [ "${result}" == "0" ]; then |
52 |
true |
69 |
true |
53 |
else |
70 |
else |
54 |
false |
71 |
false |
55 |
fi |
72 |
fi |
56 |
fi |
73 |
fi |