mkcollage.old


#! /bin/sh

host=data
host=zorb
mkcollage=/mft/home/lightner/home/mkcollage
img2map=/mft/home/lightner/home/img2map

ego=`basename $0`
usage() {
        echo "usage: $ego [-verbose] [-host host] [-title title] [-name name] [-normal|-bigger|-biggest] files..." 1>&2
        exit 1
}

pwd=`pwd`
 
verbose=0;

size=
title=
collage="collage"

runstring=
while [ $# != 0 ]
do
        case $1 in
        -host)
		shift
                host=$1
                ;;
        -verbose)
		runstring="$runstring $1"
                verbose=1
                ;;
        -normal)
		runstring="$runstring $1"
                size=normal
                ;;
        -bigger)
		runstring="$runstring $1"
                size=bigger
                ;;
        -biggest)
		runstring="$runstring $1"
                size=biggest
                ;;
        -name)
		runstring="$runstring $1 $2"
		shift
                name="-name $1"
		collage="$1"
                ;;
        -title)
		runstring="$runstring $1 '$2'"
		shift
		title=`echo x"$1"x | sed -e 's/[ ]/\\\\ /g' -e 's/^x//' -e 's/x$//'`
		title="-title $title"
                ;;
        -*)
                usage
                ;;
        *)
                break
                ;;
        esac
        shift
done

case $# in 0) usage; esac

runstring="$ego -host $host $runstring $*"

base=$ego.$$
tmp_dir=/tmp/$base
tmp=/tmp/$base
trap "rm -f $tmp; echo removing $host:$tmp_dir 1>&2; rsh -n $host 'rm -rf' $tmp_dir; exit" 0 1 2 3 15

list="$*"
case $size in
        bigger)         cmd="-maxperrow 8 -xpixels 72 -ypixels 60";;
        biggest)        cmd="-maxperrow 5  -xpixels 120 -ypixels 96";;
        normal)         cmd="-maxperrow 12 -xpixels 48 -ypixels 48";;
        *)              cmd="-maxperrow 12 -xpixels 48 -ypixels 48";;
esac
cmd="$img2map -nocom "$title" $name $cmd $list"

echo "#! /bin/sh" > $tmp
echo "cd $tmp_dir" >> $tmp
echo "$cmd" >> $tmp
chmod a+x $tmp

echo "making $host:$tmp_dir" 1>&2
rsh -n $host mkdir $tmp_dir

echo "copying files to $host:$tmp_dir" 1>&2
rcp -p $tmp $list $host:$tmp_dir

echo "running $mkcollage on $host" 1>&2
##cat $tmp
rsh -n $host $tmp_dir/$base

echo "retrieving files from $host" 1>&2
rm -f $collage.html
rm -f $collage.gif
rm -f $collage.jpg
rcp -p $host:$tmp_dir/$collage.\* .

echo "<!-- Produced on: `date` -->" >> $collage.html
echo "<!-- Produced using: $runstring -->" >> $collage.html

Back