Skip to content
Snippets Groups Projects
Commit 523ad444 authored by Tomas Lovato's avatar Tomas Lovato
Browse files

fix dummy bash issues of the build script

parent f1aff65d
No related branches found
No related tags found
1 merge request!2default pipeline to build manuals
#!/bin/sh
#!/bin/bash
#set -x
# Available manuals
......@@ -34,6 +34,13 @@ DRAFT=${x_p}
VER_NUM=${x_r}
CMP_NAM=$1
# Default case for Linux sed, just use "-i"
sedi=(-i)
case "$(uname)" in
# For macOS, use two parameters
Darwin*) sedi=(-i "")
esac
## Initialisation
##---------------
......@@ -50,7 +57,7 @@ else
fi
# Version
version=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match || "orphan"`
version=`git symbolic-ref -q --short HEAD || git describe --tags --exact-match || echo "orphan"`
if [ "x${VER_NUM}" != 'x' ] ; then
version=${VER_NUM}
fi
......@@ -66,7 +73,7 @@ echo "Compiling ${models} manual(s) at version ${version} ${draft_opt} \n"
# Set version
version=`echo $version | sed -e 's;_;\\\\\\\_;g'`
prefile="latex/global/preamble.tex"
sed -i '' -e "s;\\\def\\\ver.*;\\\def\\\ver{$version};" ${prefile}
sed "${sedi[@]}" -e "s;\\\def\\\ver.*;\\\def\\\ver{$version};" ${prefile}
# Set draft mode
docfile="latex/global/document.tex"
......@@ -75,11 +82,11 @@ pkgfile="latex/global/packages.tex"
draft_opt=`grep draft $docfile`
pkg_dft=`grep draftwatermark $pkgfile | sed -e "s;%;;g"`
if [ $ifdraft == 1 ] && [ "x$draft_opt" == "x" ] ; then
sed -i '' -e "s;,abstract;,abstract,draft;" $docfile
sed -i '' -e "s;.*draftwatermark.*;\\$pkg_dft;" $pkgfile
sed "${sedi[@]}" -e "s;,abstract;,abstract,draft;" $docfile
sed "${sedi[@]}" -e "s;.*draftwatermark.*;\\$pkg_dft;" $pkgfile
elif [ $ifdraft == 0 ] && [ "x$draft_opt" != "x" ] ; then
sed -i '' -e "s;abstract,draft;abstract;" $docfile
sed -i '' -e "s;.*draftwatermark.*;%\\$pkg_dft;" $pkgfile
sed "${sedi[@]}" -e "s;abstract,draft;abstract;" $docfile
sed "${sedi[@]}" -e "s;.*draftwatermark.*;%\\$pkg_dft;" $pkgfile
fi
# Echo current font path
......@@ -89,7 +96,6 @@ echo "Fontawesome path is $fontawesome \n"
# Source shared functions
. tools/shr_func.sh
## Check dependancies
##-------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment