--- a/codesys-ide/codesys +++ b/codesys-ide/codesys @@ -6,29 +6,36 @@ BASEPATH=$(pwd)/scripts fi -# 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 - # 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,,')") -export DISPLAY=:91 -Xvfb :91 & -sleep 10 -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=$? +# start ide? +if [ "${1}" == "ide" ]; then + 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}"'" +else -killall Xvfb -rm /tmp/.X* - -if [ "${result}" == "0" ]; then + # 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 & + sleep 10 + 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=$? + + killall Xvfb + rm /tmp/.X* + + if [ "${result}" == "0" ]; then true -else + else false + fi fi -