#!/bin/bash
#
# Utility script for installing demos in user's home directory

DEMO_DIR=/usr/share/dolfin/demo
INSTALL_DIR=$HOME/dolfin-demos
URL="http://fenicsproject.org/documentation/doc_"`echo 2019.2.0.64.dev0 | cut -d'+' -f1`".html"

echo "This script will install the DOLFIN demos in your home directory:"
echo
echo "  $INSTALL_DIR"
echo
echo -n "Do you want to install the DOLFIN demos in your home directory? [y] "
read answer

if [[ $answer == "y" || $answer == "" ]]; then
    echo "Installing demos..."
    cp -r $DEMO_DIR $INSTALL_DIR
    echo
    echo "The demos have now been installed in $INSTALL_DIR."
    echo
    echo "-------------------------------------------------------------------------------"
    echo "To get started, enter the following command:"
    echo
    echo "  cd $INSTALL_DIR/pde"
    echo
    echo "The documentation can be found at the following address:"
    echo
    echo "  $URL"
    echo "-------------------------------------------------------------------------------"
    echo
else
    echo "ok, demos not installed"
fi
