Docs: Add -b/--bump-version option to BuildDocs.tool
@@ -30,16 +30,7 @@ latexbuild() {
done
}
-cd "$(dirname "$0")" || abort "Wrong directory"
-
-if [ "$(which latexdiff)" = "" ]; then
- abort "latexdiff is missing, check your TeX Live installation"
-fi
-
-if [ "$(which pdflatex)" = "" ]; then
- abort "pdflatex is missing, check your TeX Live installation"
-fi
-
+builddocs() {
latexbuild Configuration
cd Differences || abort "Unable to process annotations"
@@ -69,10 +60,9 @@ if [ $err -ne 0 ]; then
abort "Failed to calculate built configuration hash!"
fi
+ OLDHASH=""
if [ -f "Configuration.md5" ]; then
OLDHASH=$(cat "Configuration.md5")
-else
- OLDHASH=""
fi
echo "$HASH" > "Configuration.md5"
@@ -82,5 +72,34 @@ if [ "$HASH" != "$OLDHASH" ]; then
echo "Please run ./Docs/BuildDocs.tool."
exit 1
fi
+}
+
+main() {
+ if [ "$(which latexdiff)" = "" ]; then
+ abort "latexdiff is missing, check your TeX Live installation"
+ fi
+
+ if [ "$(which pdflatex)" = "" ]; then
+ abort "pdflatex is missing, check your TeX Live installation"
+ fi
+
+ cd "$(dirname "$0")" || abort "Wrong directory"
+
+ case "$1" in
+ -b|--bump-version )
+ cd Differences || abort "Unable to enter Differences directory"
+ rm -f PreviousConfiguration.tex
+ cp ../Configuration.tex PreviousConfiguration.tex
+ cd .. || abort "Unable to enter parent directory"
+ builddocs
+ ;;
+
+ * )
+ builddocs
+ ;;
+ esac
+}
+
+main "$@"
exit 0
