#!/bin/sh

CONVERT=convert

set -e

ls /tmp

tee bad.svg <<"EOF"
<!DOCTYPE test>
<svg width="128px" height="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<image height="200" width="200" xlink:href="bad.svg" />
</svg>
EOF

error_code=0
$CONVERT -verbose -font OpenSymbol bad.svg t.png || error_code=$?
ls -l t.png || true
ls /tmp
(test -e t.png && base64 < t.png) || true
if [ error_code -gt 126]; then
    exit $error_code;
else
    exit 0;
fi

