#!/bin/bash

#
#gpg print-md has the file name and a : and also includes a bunch of spaces 
# remove them with sed
#
function strip
{
 filename=$1.$2
 sed "s/$1://g" $1.tmp > $1.tmp1
 sed "s/\s*//g" $1.tmp1 > $filename

}

#
# Read and sign the jars and zips. Assume that
# gpg and md5sum are already installed
#
for x in $(ls *.zip *.jar $1)
 do
   #gpg --detach-sign --armor --output $x.asc $x
   gpg --print-md MD5 $x > $x.tmp
   strip $x 'md5'
   gpg --print-md SHA1 $x > $x.tmp
   strip $x 'sha1'
 done


