Store log paths in variables

This commit is contained in:
Manuel Thalmann 2023-03-25 21:33:23 +01:00
parent 938a613afe
commit 9eb3f4ccfa

View file

@ -36,6 +36,8 @@ RUN \
imagemagick; \
rm -rf /var/lib/apt/lists; \
TIV="$(mktemp)"; \
logDir="logs"; \
screenDir="$logDir/screens"; \
git clone https://github.com/stefanhaustein/TerminalImageViewer.git && \
cd TerminalImageViewer/src/main/cpp && \
make && \
@ -44,8 +46,8 @@ RUN \
mv tiv "$TIV" && \
cd - && \
rm -rf TerminalImageViewer; \
mkdir -p logs; \
mkdir -p screens; \
mkdir -p "$logDir"; \
mkdir -p "$screenDir"; \
} || true; \
printHeading() { \
local heading; \
@ -112,7 +114,7 @@ RUN \
maxCount=120; \
while ps -p "$pid" > /dev/null && [ "$x" -ne "$maxCount" ]; do \
# Create screenshot and print it to the console
fileName="screens/install-try$try-$x.png"; \
fileName="$screenDir/install-try$try-$x.png"; \
import -window root "$fileName"; \
"$TIV" -w 10000 -h 10000 "$fileName"; \
x="$(expr "$x" + 1)"; \
@ -120,7 +122,7 @@ RUN \
sleep 1; \
done; \
# Kill installer after timeout indicated by `maxCount`
[ "$x" -eq "$maxCount" ] && { pkill -9 MDK537.exe; mv "$logFile" "logs/timeout-try$try.log"; }; \
[ "$x" -eq "$maxCount" ] && { pkill -9 MDK537.exe; mv "$logFile" "$logDir/timeout-try$try.log"; }; \
} & \
}; \
wait "$pid"; \
@ -130,9 +132,9 @@ RUN \
&& [ -f "$logFile" ] \
&& { \
# Move logs to location based on exit code
[ "$exitCode" -eq 0 ] && mv "$logFile" "logs/success-try$try.log"; \
[ "$exitCode" -eq 42 ] && mv "$logFile" "logs/timeout-handled-try$try.log"; \
[ "$exitCode" -ne 0 ] && mv "$logFile" "logs/fail-try$try.log"; \
[ "$exitCode" -eq 0 ] && mv "$logFile" "$logDir/success-try$try.log"; \
[ "$exitCode" -eq 42 ] && mv "$logFile" "$logDir/timeout-handled-try$try.log"; \
[ "$exitCode" -ne 0 ] && mv "$logFile" "$logDir/fail-try$try.log"; \
}; \
{ \
[ "$exitCode" -ne 0 ] && { \