Store installer at a temporary location

This commit is contained in:
Manuel Thalmann 2023-03-25 23:05:54 +01:00
parent 80d58a6854
commit be405a81b3

View file

@ -29,7 +29,11 @@ RUN \
RUN pip install pyocd
RUN \
wget "${KEIL_URL}" --progress=bar:force:noscroll -O MDK537.exe; \
installerExtension=".exe"; \
installer="$(mktemp --suffix="$installerExtension")"; \
installerName="$(basename "$installer" | sed "s/$installerExtension$//")"; \
rm "$installer"; \
wget "${KEIL_URL}" --progress=bar:force:noscroll -O "$installer"; \
[ "$DEBUG" -eq 1 ] && { \
apt-get update; \
apt-get install -y \
@ -75,7 +79,7 @@ RUN \
-e ":end q;"; \
exitCode="$?"; \
# Kill installer if it got stuck (according to console output)
[ "$exitCode" -eq 42 ] && pkill -9 MDK537.exe; \
[ "$exitCode" -eq 42 ] && pkill -9 "$installerName"; \
# Use `sed`s exit code if non-zero
[ "$exitCode" -ne 0 ] && exit "$exitCode" || \
# Return true otherwise
@ -92,7 +96,7 @@ RUN \
local exitCode; \
exitCodeFile="$(mktemp)"; \
{ \
2>&1 WINEDEBUG=+all,trace-all,warn-all /usr/bin/entrypoint wine MDK537.exe --batch-install; \
2>&1 WINEDEBUG=+all,trace-all,warn-all /usr/bin/entrypoint wine "$installer" --batch-install; \
echo "$?" > "$exitCodeFile"; \
} \
# Write output to a log file when debugging
@ -122,7 +126,7 @@ RUN \
sleep 1; \
done; \
# Kill installer after timeout indicated by `maxCount`
[ "$x" -eq "$maxCount" ] && { pkill -9 MDK537.exe; mv "$logFile" "$logDir/timeout-try$try.log"; }; \
[ "$x" -eq "$maxCount" ] && { pkill -9 "$installerName"; mv "$logFile" "$logDir/timeout-try$try.log"; }; \
} & \
}; \
wait "$pid"; \
@ -176,7 +180,7 @@ RUN \
# Cleanup Unnecessary Files
rm -f "$TIV"; \
rm -rf "$(/usr/bin/entrypoint winepath 'C:\Keil_v5')/Backup."*; \
rm MDK537.exe; \
rm "$installer"; \
rm -f /tmp/.X*-lock; \
[ "$DEBUG" -eq 1 ] && { \
apt-get remove -y imagemagick; \