Reorder functions in installer script

This commit is contained in:
Manuel Thalmann 2023-03-25 23:06:48 +01:00
parent be405a81b3
commit a273143d5c

View file

@ -61,30 +61,6 @@ RUN \
[ -z "$1" ] && cat || echo "$1"; \
echo "$heading"; \
}; \
# Handle console output of Keil uVision installer
handle_output() { \
# A pattern that is supposed to indicates that wine got stuck
pattern="fixme:win:NtUserLockWindowUpdate ((nil))"; \
# The amount of times the pattern should occur for the process to be considered stuck
patternCount=2; \
sed \
-u \
# Handle multiple occurrences of $pattern
-e "/$pattern/{ x; s/^x\{$(expr $patternCount - 1)\}$/\0/; x; t stuck; x; s/^\(x*\)$/\1x/; x; };" \
# Return to start
-e "b;" \
# Branch "stuck": delete output and exit with code 42
-e ":stuck q42;" \
# Branch "end": exit with code 0
-e ":end q;"; \
exitCode="$?"; \
# Kill installer if it got stuck (according to console output)
[ "$exitCode" -eq 42 ] && pkill -9 "$installerName"; \
# Use `sed`s exit code if non-zero
[ "$exitCode" -ne 0 ] && exit "$exitCode" || \
# Return true otherwise
true; \
}; \
# Run actual Keil uVision installer
install_keil() { \
try="$1"; \
@ -150,6 +126,30 @@ RUN \
} | printHeading; \
return "$exitCode"; \
}; \
# Handle console output of Keil uVision installer
handle_output() { \
# A pattern that is supposed to indicates that wine got stuck
pattern="fixme:win:NtUserLockWindowUpdate ((nil))"; \
# The amount of times the pattern should occur for the process to be considered stuck
patternCount=2; \
sed \
-u \
# Handle multiple occurrences of $pattern
-e "/$pattern/{ x; s/^x\{$(expr $patternCount - 1)\}$/\0/; x; t stuck; x; s/^\(x*\)$/\1x/; x; };" \
# Return to start
-e "b;" \
# Branch "stuck": delete output and exit with code 42
-e ":stuck q42;" \
# Branch "end": exit with code 0
-e ":end q;"; \
exitCode="$?"; \
# Kill installer if it got stuck (according to console output)
[ "$exitCode" -eq 42 ] && pkill -9 "$installerName"; \
# Use `sed`s exit code if non-zero
[ "$exitCode" -ne 0 ] && exit "$exitCode" || \
# Return true otherwise
true; \
}; \
display=:90; \
export DISPLAY="$display"; \
mkdir -p --mode=777 /tmp/.X11-unix; \