#!/bin/bash

#################################################################
#
# Script name: countdown_banner.sh
# This small script making for help export PNG files from SVG template.
#
#################################################################

MAXPARAMS=2 # count command line parametrs
banner_name=fedora16-countdown-banner- # base name banner
lang=$2 # language code from command line


if [ $# -lt "$MAXPARAMS" ];
then
echo
echo "----------------------------------------------------------"
echo "Fedora 16 countdown banner script export SVG to PNG files."
echo "----------------------------------------------------------"
echo
echo "Usage: countdown_banner.sh file.svg lang"
echo
echo "file.svg - source svg file"
echo "lang - language code (en, ru, de ...)"
echo "Example: countdown_banner.sh fedora16-countdown-banner-en.svg en"
echo
exit 0
fi

langcode=.$lang

for ((banner_count=1; banner_count <= 35 ; banner_count++))
do
    banner=$banner_name$banner_count
echo "--> create $banner$langcode.png"
    inkscape --without-gui --export-png=$banner$langcode.png --export-id=$banner --export-id-only $1 > /dev/null
done

# Creating tar.gz archive
echo
echo "--> create $banner_name$lang.tar.gz"
echo
tar -cvzf $banner_name$lang.tar.gz $banner_name*$langcode* > /dev/null
exit