| a/codesys-ide/codesys | b/codesys-ide/codesys | ||
|---|---|---|---|
... |
... |
||
| 5 | else |
5 | else |
| 6 | BASEPATH=$(pwd)/scripts |
6 | BASEPATH=$(pwd)/scripts |
| 7 | fi |
7 | fi |
| 8 | 8 | ||
| 9 | # get first CODESYS profile and start the script with it |
9 | # get first CODESYS profile and start the script with it |
| 10 | profile=$(basename "$(ls -1 ~/.wine.cds/drive_c/CODESYS/CODESYS/Profiles/*.profile | head -n 1 | sed 's,.profile,,')") |
10 | profile=$(basename "$(ls -1 ~/.wine.cds/drive_c/CODESYS/CODESYS/Profiles/*.profile | head -n 1 | sed 's,.profile,,')") |
| 11 | libdoc=$(ls -1 /home/labi/.wine.cds/drive_c/CODESYS/CODESYS/DocScripting/*/libdoc.exe) |
||
| 11 | 12 | ||
| 12 | # start ide? |
13 | # start ide? |
| 13 | if [ "${1}" == "ide" ]; then |
14 | if [ "${1}" == "ide" ]; then |
| 14 | export WINEPREFIX=~/.wine.cds |
15 | export WINEPREFIX=~/.wine.cds |
| 15 | export WINEDEBUG=-all |
16 | export WINEDEBUG=-all |
| 16 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
17 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
| 17 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" |
18 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" |
| 19 | elif [ "${1}" == "export-libdoc" ]; then |
||
| 20 | export WINEPREFIX=~/.wine.cds |
||
| 21 | export WINEDEBUG=-all |
||
| 22 | export LIBDOC_CODESYS="c:/CODESYS/CODESYS/Common/CODESYS.exe --profile=\"${profile}\"" |
||
| 23 | for i in $(find -iname \*.library); do |
||
| 24 | wine-development ${libdoc} make ${i} html |
||
| 25 | libbase=$(basename $i .library) |
||
| 26 | libdir=$(dirname $i) |
||
| 27 | if [ -d ${libdir}/${libbase}-html ]; then |
||
| 28 | mkdir -p .drone-artifacts/${libdir} |
||
| 29 | zip .drone-artifacts/${libdir}/${libbase}.zip ${libdir}/${libbase}-html |
||
| 30 | fi |
||
| 31 | done |
||
| 18 | else |
32 | else |
| 19 | 33 | ||
| 20 | # check if file exists, before we call CODESYS with it |
34 | # check if file exists, before we call CODESYS with it |
| 21 | if [ ! -f ${BASEPATH}/${1}.py ]; then |
35 | if [ ! -f ${BASEPATH}/${1}.py ]; then |
| 22 | echo "error: script '${BASEPATH}/${1}.py' not found." |
36 | echo "error: script '${BASEPATH}/${1}.py' not found." |
... |
... |
||
| 26 | export DISPLAY=:91 |
40 | export DISPLAY=:91 |
| 27 | Xvfb :91 &> /dev/zero & |
41 | Xvfb :91 &> /dev/zero & |
| 28 | sleep 1 |
42 | sleep 1 |
| 29 | export WINEPREFIX=~/.wine.cds |
43 | export WINEPREFIX=~/.wine.cds |
| 30 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
44 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
| 31 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI |
45 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI |
| 32 | result=$? |
46 | result=$? |
| 33 | sleep 1 |
47 | sleep 1 |
| 34 | killall Xvfb |
48 | killall Xvfb |
| 35 | rm -rf /tmp/.X* |
49 | rm -rf /tmp/.X* |
| 36 | 50 |