| a/codesys-ide/codesys | b/codesys-ide/codesys | ||
|---|---|---|---|
... |
... |
||
| 4 | BASEPATH=/usr/local/share/codesys |
4 | BASEPATH=/usr/local/share/codesys |
| 5 | else |
5 | else |
| 6 | BASEPATH=$(pwd)/scripts |
6 | BASEPATH=$(pwd)/scripts |
| 7 | fi |
7 | fi |
| 8 | 8 | ||
| 9 | # check if file exists, before we call CODESYS with it |
9 | # get first CODESYS profile and start the script with it |
| 10 | if [ ! -f ${BASEPATH}/${1}.py ]; then |
||
| 11 | echo "error: script '${BASEPATH}/${1}.py' not found." |
||
| 12 | exit -1 |
||
| 13 | fi |
||
| 14 | |||
| 15 | # get first CODESYS profile and start the script with it |
||
| 16 | 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,,')") |
| 17 | 11 | ||
| 18 | export DISPLAY=:91 |
12 | # start ide? |
| 13 | if [ "${1}" == "ide" ]; then |
||
| 14 | export WINEPREFIX=~/.wine.cds |
||
| 15 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
||
| 16 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" |
||
| 17 | else |
||
| 18 | |||
| 19 | # check if file exists, before we call CODESYS with it |
||
| 20 | if [ ! -f ${BASEPATH}/${1}.py ]; then |
||
| 21 | echo "error: script '${BASEPATH}/${1}.py' not found." |
||
| 22 | exit -1 |
||
| 23 | fi |
||
| 24 | |||
| 25 | export DISPLAY=:91 |
||
| 19 | Xvfb :91 & |
26 | Xvfb :91 & |
| 20 | sleep 10 |
27 | sleep 10 |
| 21 | export WINEPREFIX=~/.wine.cds |
28 | export WINEPREFIX=~/.wine.cds |
| 22 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
29 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/test.py" --noUI |
| 23 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI |
30 | wine-development ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI |
| 24 | result=$? |
31 | result=$? |
| 25 | 32 | ||
| 26 | killall Xvfb |
33 | killall Xvfb |
| 27 | rm /tmp/.X* |
34 | rm /tmp/.X* |
| 28 | 35 | ||
| 29 | if [ "${result}" == "0" ]; then |
36 | if [ "${result}" == "0" ]; then |
| 30 | true |
37 | true |
| 31 | else |
38 | else |
| 32 | false |
39 | false |
| 33 | fi |
40 | fi |
| 34 | 41 | fi |