#!/bin/sh
#
# Generate SVG status badge.
#

NAME="$1"
STATUS="$2"

if [ "$STATUS" = "ok" ]; then
    COLOR="#00CC00"
    TEXT="passing"
else
    COLOR="#e05d44"
    TEXT="failing"
fi

cat > /mnt/sda/www/badge/$NAME.svg <<EOF
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="20">
  <rect rx="3" width="120" height="20" fill="#555"/>
  <rect rx="3" x="60" width="60" height="20" fill="$COLOR"/>
  <g fill="#fff" text-anchor="middle"
     font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
    <text x="30" y="14">$NAME</text>
    <text x="90" y="14">$TEXT</text>
  </g>
</svg>
EOF
