#!/bin/bash if [ $# != 2 ] ; then echo "Usage: imageis-add-jpg-file.sh collection file.jpg" exit fi col=$1 srcfilename=$2 if [ ! -f "$srcfilename" ] ; then echo "Error: failed to find $srcfilename" exit fi filetail=${srcfilename##*/} docid=${filetail%.*} # make sure file extension is lowercase .jpg dstfile=$docid.jpg if [ "x$col" != "x" ] ; then dstfile="$col:$dstfile" fi dstfilename=/tmp/vsupload/$dstfile /bin/cp "$srcfilename" "$dstfilename" echo "Generating add_file.xml" cat "$IMAGEISHOME/templates/add_file.xml" \ | sed "s@\*\*imgfile\*\*@$dstfile@g" \ > "/tmp/vsupload/add_file.xml" echo "Ingesting $dstfile" java -jar "$IMAGEISHOME/ImageIS.jar" "/tmp/vsupload/add_file.xml" if [ $? == "0" ] ; then /bin/rm "/tmp/vsupload/add_file.xml" fi