#!/bin/bash # Take 80x25 screen shot from the end of a text file, and excape it for html. proc process_text_file { setvar X = '0' # Break into 80 line chunks, substituting &, < and > sed -e 's/\(................................................................................\)/\1\n/g' $1 | \ tail -n 25 | while read i { 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 test $X -eq 0 { setvar X = ${#i} while [ $X -lt 80 ] { echo -n ' ' setvar X = $[$X+1] } } echo } } proc wrap_screenshot { echo '' cat <<< """ boot log cross compiler
native compiler
root filesystem
system image

busybox binary
dropbear binary
strace binary
""" 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/') { wrap_screenshot $i > "screenshot-$i.html" }