source: gs3-extensions/pharos/trunk/cmdline-api-srcpack/bin/script/pharos-imageis-add.sh@ 21197

Last change on this file since 21197 was 21197, checked in by davidb, 14 years ago

renaming of scripts

File size: 776 bytes
Line 
1#!/bin/bash
2
3if [ $# != 2 ] ; then
4 echo "Usage: imageis-add-jpg-file.sh collection file.jpg"
5 exit
6fi
7
8col=$1
9srcfilename=$2
10
11if [ ! -f "$srcfilename" ] ; then
12 echo "Error: failed to find $srcfilename"
13 exit
14fi
15
16filetail=${srcfilename##*/}
17docid=${filetail%.*}
18
19# make sure file extension is lowercase .jpg
20
21dstfile=$docid.jpg
22if [ "x$col" != "x" ] ; then
23 dstfile="$col:$dstfile"
24fi
25dstfilename=/tmp/vsupload/$dstfile
26
27/bin/cp "$srcfilename" "$dstfilename"
28
29echo "Generating add_file.xml"
30cat "$IMAGEISHOME/templates/add_file.xml" \
31 | sed "s@\*\*imgfile\*\*@$dstfile@g" \
32 > "/tmp/vsupload/add_file.xml"
33
34echo "Ingesting $dstfile"
35
36java -jar "$IMAGEISHOME/ImageIS.jar" "/tmp/vsupload/add_file.xml"
37
38if [ $? == "0" ] ; then
39 /bin/rm "/tmp/vsupload/add_file.xml"
40fi
Note: See TracBrowser for help on using the repository browser.