#!/bin/bash # Take 80x25 screen shot from the end of a text file, and excape it for html. process_text_file() { X=0 # Break into 80 line chunks, substituting &, < and > sed -e 's/\(................................................................................\)/\1\n/g' "$1" | \ tail -n 25 | while read i do echo -n "$i" | sed -e 's@\&@\&@g' -e 's@<@\<@g' -e 's@>@\>@g' # If the first line is shorter than 80 characters, pad it. if [ $X -eq 0 ] then X=${#i} while [ $X -lt 80 ] do echo -n ' ' X=$[$X+1] done fi echo done } wrap_screenshot() { echo '' cat << EOF boot log cross compiler
native compiler
root filesystem
system image

busybox binary
dropbear binary
strace binary
EOF echo '' echo '
'
  process_text_file "bootlog-$1.txt"
  echo '
' echo echo '' } # Harvest screenshots from each system image more/for-each-target.sh '(sleep 20 && echo -n cat "/proc" && sleep 1 && echo /cpuinfo && sleep 2 && echo exit) | more/run-emulator-from-build.sh $TARGET | tee www/screenshots/bootlog-$TARGET.txt' cd www/screenshots # Filter out escape sequence (shell asking the current screen size) sed -i $(echo -e 's/\033\[6n//g;s/\015$//') bootlog-*.txt # Create html snippet for i in $(ls bootlog-*.txt | sed 's/bootlog-\(.*\)\.txt/\1/') do wrap_screenshot "$i" > "screenshot-$i.html" done