#!/bin/bash

source ../cascade-make/lib/cascade-lib.bash GEXT_JENA .. $*


if [ $install = "1"  ] ; then

  echo "===="
  echo "= Installing GS Triplestore Wrapper scripts (for Fuseki3)"
  echo "=="

#  triple_store="$GEXT_JENA/etc/tdb-triple-store3"
#  if [ ! -d "$triple_store" ] ; then
#    echo "= Creating empty triple-store:"
#    echo "    $triple_store"
#    mkdir "$triple_store"
#
#    /bin/cp tdb3.ttl "$GEXT_JENA/etc/."
#  fi

  if [ ! -d "$GEXT_JENA/bin" ] ; then
    mkdir "$GEXT_JENA/bin"
  fi

  if [ ! -d "$GEXT_JENA/bin/script3" ] ; then
    mkdir "$GEXT_JENA/bin/script3"
  fi

  echo '= Installing gs-triplestore-* server-side scripts'
  /bin/cp gs-triplestore-* $GEXT_JENA/bin/script3/.
  chmod a+rx $GEXT_JENA/bin/script3/gs-triplestore-*

#  echo "= Installing Greenstone-style CSS"
#  /bin/cp fuseki.css $GEXT_JENA/etc/pages/.
#  chmod a+r $GEXT_JENA/etc/pages/fuseki.css
  
  echo "= Transferring Fuseki XSL files (originally from v1) to Fuseki-v3 for GS3 client-side suppport"
  /bin/cp "$GEXT_JENA/etc/pages/"*.xsl "$GEXT_JENA/packages/apache-jena-fuseki-3.17.0/webapp/."

  echo "===="
  echo ""

fi
