Fix SD card flashing progress display

- Remove pv (showed read progress, not write progress)
- Use dd status=progress for actual write progress
- Reduce block size to 1M (better for slow SD cards)
- Remove conv=fsync (sync at end instead, faster)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-08 13:40:31 -05:00
parent 252efbec7e
commit a30ec33b98

View File

@@ -278,29 +278,16 @@ echo ""
echo -e "${GREEN}Flashing image to $SELECTED...${NC}"
echo ""
# Flash with dd (optionally with pv for progress)
if [ "$HAS_PV" = true ]; then
echo -e "${YELLOW}Flashing with progress...${NC}"
if [ "$COMPRESSED" = true ]; then
# Flash with dd (status=progress shows actual write progress)
echo -e "${YELLOW}Flashing (this may take several minutes for SD cards)...${NC}"
if [ "$COMPRESSED" = true ]; then
case "$COMP_TYPE" in
xz) pv "$IMAGE" | xzcat | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null ;;
zst) pv "$IMAGE" | zstdcat | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null ;;
gz) pv "$IMAGE" | zcat | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null ;;
xz) xzcat "$IMAGE" | sudo dd of="$SELECTED" bs=1M status=progress ;;
zst) zstdcat "$IMAGE" | sudo dd of="$SELECTED" bs=1M status=progress ;;
gz) zcat "$IMAGE" | sudo dd of="$SELECTED" bs=1M status=progress ;;
esac
else
pv "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync 2>/dev/null
fi
else
echo -e "${YELLOW}Flashing (install pv for progress bar)...${NC}"
if [ "$COMPRESSED" = true ]; then
case "$COMP_TYPE" in
xz) xzcat "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync status=progress ;;
zst) zstdcat "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync status=progress ;;
gz) zcat "$IMAGE" | sudo dd of="$SELECTED" bs=4M conv=fsync status=progress ;;
esac
else
sudo dd if="$IMAGE" of="$SELECTED" bs=4M conv=fsync status=progress
fi
sudo dd if="$IMAGE" of="$SELECTED" bs=1M status=progress
fi
echo ""