#!/bin/bash

if [ "x$GSDL3HOME" = "x" ] ; then
    echo ""
    GSDL3HOME=../../../web
    echo "Using relative diretory for GSDL3HOME:"
    echo "  $GSDL3HOME"
    echo ""
fi

if [ ! -d "$GSDL3HOME/ext/structured-image/" ] ; then
    echo ""
    echo "Creating directory:"
    echo "    $GSDL3HOME/ext/structured-image"
    echo ""
    mkdir "$GSDL3HOME/ext/structured-image"
fi

if [ -d "$GSDL3HOME/ext/structured-image/js" ] ; then
    echo ""
    echo "Removing previous installation:"
    echo "    $GSDL3HOME/ext/structured-image/js"

    /bin/rm -rf "$GSDL3HOME/ext/structured-image/js"
fi

echo ""
echo "Installing additional (topup/extra) JS library for Greenstone:"
echo "    $GSDL3HOME/ext/structured-image/js"

/bin/cp -r js "$GSDL3HOME/ext/structured-image/."

echo ""

