From 1491491576fbf537d07abdfbe3ad09cc06eefbd4 Mon Sep 17 00:00:00 2001
From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de>
Date: Mon, 20 Apr 2020 21:26:38 +0200
Subject: [PATCH] [install][external] Add install course and lecture as options

* adapt script
* adapt handbook to include more options
---
 bin/installexternal.sh             | 40 ++++++++++++++++++++++++++++++
 doc/handbook/4_course.tex          |  3 ++-
 doc/handbook/4_furtherpractice.tex |  6 ++---
 3 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/bin/installexternal.sh b/bin/installexternal.sh
index 9ffdbcb6ff..98d5da318d 100755
--- a/bin/installexternal.sh
+++ b/bin/installexternal.sh
@@ -10,6 +10,8 @@ DOWNLOAD_ONLY="n"
 TOPDIR=$(pwd)
 EXTDIR=$(pwd)/external
 
+DUMUX_VERSION=3.2
+
 checkLocationForDuneModules()
 {
     # test for directory dune-common, dune-common-2.4 etc.
@@ -53,6 +55,19 @@ installAluGrid()
     fi
 }
 
+installCourse()
+{
+    cd $TOPDIR
+    if [ ! -d "dumux-course" ]; then
+        git clone -b releases/$DUMUX_VERSION https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course.git
+    else
+        echo "Skip cloning dumux-course because the folder already exists."
+        cd dumux-course
+        git checkout releases/$DUMUX_VERSION
+        cd ..
+    fi
+}
+
 installFoamGrid()
 {
     cd $TOPDIR
@@ -135,6 +150,19 @@ installGStat()
     fi
 }
 
+installLecture()
+{
+    cd $TOPDIR
+    if [ ! -d "dumux-lecture" ]; then
+        git clone -b releases/$DUMUX_VERSION https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-lecture.git
+    else
+        echo "Skip cloning dumux-lecture because the folder already exists."
+        cd dumux-lecture
+        git checkout releases/$DUMUX_VERSION
+        cd ..
+    fi
+}
+
 installMETIS()
 {
     cd $EXTDIR
@@ -404,9 +432,11 @@ usage()
     echo "Where PACKAGES is one or more of the following"
     echo "  all              Install everything and the kitchen sink."
     echo "  alugrid          Download dune-alugrid."
+    echo "  course           Download the dumux-course."
     echo "  foamgrid         Download dune-foamgrid."
     echo "  glpk             Download and install glpk."
     echo "  gstat            Download and install gstat."
+    echo "  lecture          Download the dumux-lecture."
     echo "  metis            Install the METIS graph partitioner."
     echo "  multidomain      Download dune-multidomain."
     echo "  multidomaingrid  Download and patch dune-multidomaingrid."
@@ -471,9 +501,11 @@ for TMP in "$@"; do
             SOMETHING_DONE="y"
             createExternalDirectory
             installAluGrid
+            installCourse
             installFoamGrid
             installGLPK
             installGStat
+            installLecture
             installMETIS
             installMultidomain
             installMultidomainGrid
@@ -487,6 +519,10 @@ for TMP in "$@"; do
             SOMETHING_DONE="y"
             installAluGrid
             ;;
+        course)
+            SOMETHING_DONE="y"
+            installCourse
+            ;;
         foamgrid|dune-foamgrid)
             SOMETHING_DONE="y"
             installFoamGrid
@@ -501,6 +537,10 @@ for TMP in "$@"; do
             createExternalDirectory
             installGStat
             ;;
+        lecture)
+            SOMETHING_DONE="y"
+            installLecture
+            ;;
         metis)
             SOMETHING_DONE="y"
             createExternalDirectory
diff --git a/doc/handbook/4_course.tex b/doc/handbook/4_course.tex
index 17016c5bbc..bb083fd8a9 100644
--- a/doc/handbook/4_course.tex
+++ b/doc/handbook/4_course.tex
@@ -25,7 +25,8 @@ $ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/rele
 \end{lstlisting}
 This script will install \texttt{dumux}, it's Dune dependencies, and the \texttt{dumux-course}
 repository. Within the directory \texttt{dumux-course} there are a series of exercises
-and slides describing the previously described examples. \par
+and slides describing the previously described examples. The course can also be added to your existing 
+dumux installation using the \texttt{installExternal.sh} script and the argument \texttt{course}.\par
 %
 The \Dumux course will be updated with each \Dumux release.
 The above script will download the correct version (\textbf{releases/3.2}) of both
diff --git a/doc/handbook/4_furtherpractice.tex b/doc/handbook/4_furtherpractice.tex
index 76c6c31209..194781c9b6 100644
--- a/doc/handbook/4_furtherpractice.tex
+++ b/doc/handbook/4_furtherpractice.tex
@@ -9,10 +9,8 @@ cases can be found in the class documentation \url{http://www.dumux.org/document
 Another possibility to gain more experience with \Dumux is the \texttt{dumux-lecture} module
 that contains different application examples that are used in the lectures at the
 Department of Hydromechanics and Modelling of Hydrosystems in Stuttgart.
-The \texttt{dumux-lecture} module can be obtained as follows:
-\begin{lstlisting}[style=Bash]
-$ git clone https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-lecture.git
-\end{lstlisting}
+The \texttt{dumux-lecture} module can be obtained with the \texttt{installExternal.sh} 
+script and the argument \texttt{lecture}. 
 
 The module is structured based on the different lectures:
 \begin{itemize}
-- 
GitLab