Fix build script to check log content instead of exit code

- live-build doesn't return correct exit codes on failure
- Now checks for 'E:.*failure occurred' in build log
- This properly detects build failures and triggers retry logic
- Should now correctly handle the devuan-keyring error and retry
parent aa5c1717
......@@ -37,33 +37,39 @@ fi
echo "Starting ISO build..."
lb build 2>&1 | tee build.log
BUILD_EXIT_CODE=$?
if [ $BUILD_EXIT_CODE -eq 0 ]; then
echo "Build completed successfully!"
echo "ISO file: $(ls live-image-amd64.iso 2>/dev/null || ls *.iso 2>/dev/null || echo 'Not found')"
else
# Check for build errors in the log instead of relying on exit code
if grep -q "E:.*failure occurred" build.log; then
echo "DEBUG: Build failed based on log content"
# Check if the error is about missing devuan-keyring
if grep -q "Couldn't find these debs: devuan-keyring" build.log; then
echo "DEBUG: Detected missing devuan-keyring error"
echo "Detected missing devuan-keyring. Downloading locally..."
if apt-get download devuan-keyring 2>&1 | tee -a build.log; then
echo "DEBUG: apt-get download succeeded"
echo "devuan-keyring downloaded successfully. Retrying build..."
rm -f build.log
echo "DEBUG: Starting retry build..."
lb build 2>&1 | tee build_retry.log
if [ $? -eq 0 ]; then
# Check retry log for errors
if grep -q "E:.*failure occurred" build_retry.log; then
echo "Build failed again. Check build_retry.log for errors."
exit 1
else
echo "Build completed successfully!"
echo "ISO file: $(ls live-image-amd64.iso 2>/dev/null || ls *.iso 2>/dev/null || echo 'Not found')"
exit 0
else
echo "Build failed again. Check build_retry.log for errors."
exit 1
fi
else
echo "DEBUG: apt-get download failed"
echo "Failed to download devuan-keyring. Build cannot continue."
exit 1
fi
else
echo "DEBUG: Error is not about devuan-keyring"
echo "Build failed. Check build.log for errors."
exit 1
fi
else
echo "Build completed successfully!"
echo "ISO file: $(ls live-image-amd64.iso 2>/dev/null || ls *.iso 2>/dev/null || echo 'Not found')"
fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment