From a273143d5cf72f1d28397ff83cac9fc19e5b5506 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 25 Mar 2023 23:06:48 +0100 Subject: [PATCH] Reorder functions in installer script --- Dockerfile | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index f125aaf..13ebd1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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; \