chain.sh 687 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # chain.sh — compile a list of workfiles, fresh M2 boot per file.
  3. # Usage: chain.sh <drive-dir> <file1> [file2 ...]
  4. # Prints last lines of each compile for inspection.
  5. DRV="$1"; shift
  6. for f in "$@"; do
  7. cat > /tmp/m2one_$$.txt <<EOF
  8. SLEEP 2
  9. SEND D:\r
  10. EXPECT D>
  11. SEND M2\r
  12. EXPECT ork file
  13. SLEEP 2
  14. SEND C
  15. EXPECT Workfile name
  16. SEND $f\r
  17. SLEEP 20
  18. EOF
  19. echo "############ $f"
  20. python3 tools/m2drive.py "$DRV" /tmp/m2one_$$.txt 2>&1 | python3 -c "
  21. import sys,re
  22. out = sys.stdin.read()
  23. clean = re.sub(r'\x1b\[[0-9;?]*[a-zA-Z]|\x1b[()][AB0]', '', out)
  24. i = clean.find('Workfile name:')
  25. seg = clean[i:i+700] if i>=0 else clean[-400:]
  26. print(repr(seg))"
  27. done
  28. rm -f /tmp/m2one_$$.txt