|
a/codesys-ide/codesys |
|
b/codesys-ide/codesys |
|
... |
|
... |
| 82 |
if [ ! -f ${BASEPATH}/${1}.py ]; then |
82 |
if [ ! -f ${BASEPATH}/${1}.py ]; then |
| 83 |
echo "error: script '${BASEPATH}/${1}.py' not found." |
83 |
echo "error: script '${BASEPATH}/${1}.py' not found." |
| 84 |
exit -1 |
84 |
exit -1 |
| 85 |
fi |
85 |
fi |
| 86 |
|
86 |
|
|
|
87 |
export DISPLAY=:91 |
|
|
88 |
Xvfb :91 &> /dev/zero & |
|
|
89 |
sleep 1 |
| 87 |
export WINEPREFIX=~/.wine.cds |
90 |
export WINEPREFIX=~/.wine.cds |
| 88 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI 2> /dev/zero |
91 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI 2> /dev/zero |
| 89 |
# remove output log |
92 |
# remove output log |
| 90 |
[ -f .codesys.output.txt ] && rm -f .codesys.output.txt |
93 |
[ -f .codesys.output.txt ] && rm -f .codesys.output.txt |
| 91 |
# check if script runs with or without UI |
94 |
# check if script runs with or without UI |
| 92 |
if grep '# CODESYS with UI' "${BASEPATH}/${1}.py" 2>&1 > /dev/zero; then |
95 |
if grep '# CODESYS with UI' "${BASEPATH}/${1}.py" 2>&1 > /dev/zero; then |
| 93 |
export DISPLAY=:91 |
|
|
| 94 |
Xvfb :91 &> /dev/zero & |
|
|
| 95 |
sleep 1 |
|
|
| 96 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" 2> /dev/zero |
96 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" 2> /dev/zero |
| 97 |
killall Xvfb |
|
|
| 98 |
rm -rf /tmp/.X91* |
|
|
| 99 |
else |
97 |
else |
| 100 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI 2> /dev/zero |
98 |
${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI 2> /dev/zero |
| 101 |
fi |
99 |
fi |
| 102 |
result=$? |
100 |
result=$? |
| 103 |
|
101 |
|
| 104 |
# flush output log |
102 |
# flush output log |
| 105 |
[ -f .codesys.output.txt ] && cat .codesys.output.txt |
103 |
[ -f .codesys.output.txt ] && cat .codesys.output.txt |
| 106 |
sleep 1 |
104 |
sleep 1 |
|
|
105 |
killall Xvfb |
|
|
106 |
rm -rf /tmp/.X91* |
| 107 |
|
107 |
|
| 108 |
if [ "${result}" == "0" ]; then |
108 |
if [ "${result}" == "0" ]; then |
| 109 |
true |
109 |
true |
| 110 |
else |
110 |
else |
| 111 |
false |
111 |
false |