From c336aee16fd7f047019e9d783586e32b66903b4d Mon Sep 17 00:00:00 2001 From: "Achim D. Brucker" Date: Sun, 8 Apr 2018 15:58:18 +0100 Subject: [PATCH] Added version check. --- document-generator/document-template/build | 22 ++++++++++++++++++++-- document-generator/install | 6 +++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/document-generator/document-template/build b/document-generator/document-template/build index 1c1813a..c426be9 100755 --- a/document-generator/document-template/build +++ b/document-generator/document-template/build @@ -36,8 +36,8 @@ ROOT_NAME="root_$NAME" if [ ! -f $ISABELLE_HOME_USER/DOF/lib/dof_latex_converter.jar ]; then echo "" - echo " Warning" - echo " =======" + echo "Warning: Isabelle DOF not installed" + echo "========" echo "This is a Isabelle_DOF project. The document preparation requires" echo "the Isabelle_DOF framework. Please obtain the framework by cloning" echo "the Isabelle_DOF git repository, i.e.: " @@ -49,6 +49,24 @@ if [ ! -f $ISABELLE_HOME_USER/DOF/lib/dof_latex_converter.jar ]; then exit 1 fi +VERSION=$($ISABELLE_TOOL scala $ISABELLE_HOME_USER/DOF/lib/dof_latex_converter.jar -v) || true + +if [ "$VERSION" != "" ]; then + echo "" + echo "Warning: Isabelle DOF version mismatch" + echo "========" + echo " Build script version: " + echo " DOF LaTeX Converter version: $VERSION" + echo " Please take one of the following actions:" + echo " * If the build script is more recent than the converter, " + echo " then update the build script from your your Isabelle DOF" + echo " installation:" + echo " $ISABELLE_HOME_USER/DOF/document-template/build" + echo " * If the converter is more recent than the build script," + echo " please update your Isabelle DOF installation." + exit 1 +fi + $ISABELLE_TOOL scala $ISABELLE_HOME_USER/DOF/lib/dof_latex_converter.jar . cp $ISABELLE_HOME_USER/DOF/latex/DOF.sty . diff --git a/document-generator/install b/document-generator/install index cb085fd..dd88001 100755 --- a/document-generator/install +++ b/document-generator/install @@ -55,14 +55,18 @@ echo "Installing library in $DIR" mkdir -p "$DIR" cp converter/bin/*.jar "$DIR" +VERSION=`$ISABELLE scala converter/bin/*.jar -v` + DIR="$ISABELLE_HOME_USER/DOF/document-template" echo "Installing document templates in $DIR" mkdir -p "$DIR" cp document-template/* "$DIR" +sed -i -e "s//$VERSION/" "$DIR"/build + DIR="$ISABELLE_HOME_USER/DOF/latex" echo "Installing LaTeX styles in $DIR" mkdir -p "$DIR" cp latex/*.sty "$DIR" -echo "Installation successful." +echo "Installation of $VERSION successful."