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