Diff of /codesys-ide/codesys [ed9c30] .. [7c4eb7]  Maximize  Restore

Switch to unified view

a/codesys-ide/codesys b/codesys-ide/codesys
...
...
2
2
3
WINE=wine-development
3
WINE=wine-development
4
4
5
if [ -d /usr/local/share/codesys ]; then
5
if [ -d /usr/local/share/codesys ]; then
6
    BASEPATH=/usr/local/share/codesys
6
    BASEPATH=/usr/local/share/codesys
7
else    
7
else
8
    BASEPATH=$(pwd)/scripts
8
    BASEPATH=$(dirname ${0})/scripts
9
fi
9
fi
10
10
11
# get first CODESYS profile and start the script with it
11
# get first CODESYS profile and start the script with it
12
profile=$(basename "$(ls -1 ~/.wine.cds/drive_c/CODESYS/CODESYS/Profiles/*.profile* | head -n 1 | sed 's,\.profile.*,,')")
12
profile=$(basename "$(ls -1 ~/.wine.cds/drive_c/CODESYS/CODESYS/Profiles/*.profile* | head -n 1 | sed 's,\.profile.*,,')")
13
libdoc=$(ls -1 ${HOME}/.wine.cds/drive_c/CODESYS/CODESYS/DocScripting/*/libdoc.exe)
13
libdoc=$(ls -1 ${HOME}/.wine.cds/drive_c/CODESYS/CODESYS/DocScripting/*/libdoc.exe)
...
...
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
90
    export WINEPREFIX=~/.wine.cds
87
    export WINEPREFIX=~/.wine.cds
91
    ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI 2> /dev/zero
88
    ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/noop.py" --noUI 2> /dev/zero
92
    # remove output log
89
    # remove output log
93
    [ -f .codesys.output.txt ] && rm -f .codesys.output.txt
90
    [ -f .codesys.output.txt ] && rm -f .codesys.output.txt
94
    # check if script runs with or without UI
91
    # check if script runs with or without UI
95
    if grep '# CODESYS with UI' "${BASEPATH}/${1}.py" 2>&1 > /dev/zero; then
92
    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*
97
    else
99
    else
98
    ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI 2> /dev/zero
100
    ${WINE} ~/.wine.cds/drive_c/CODESYS/CODESYS/Common/CODESYS.exe --culture=en --profile="'"${profile}"'" --runscript="z:${BASEPATH}/${1}.py" --noUI 2> /dev/zero
99
    fi
101
    fi
100
    result=$?
102
    result=$?
101
103
102
    # flush output log
104
    # flush output log
103
    [ -f .codesys.output.txt ] && cat .codesys.output.txt
105
    [ -f .codesys.output.txt ] && cat .codesys.output.txt
104
     sleep 1
106
     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