From 99f293b4147dd4ac3fe131f0d0ac0a1d3681e5f6 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 28 Feb 2021 10:49:00 -0700 Subject: [PATCH] install.sh: add installation preconditions check As the last step before actually starting to do the install, add a preconditions check phase. Currently the only check is that the Markdown module can be used and that it produces the expected output on a very tiny test case. Signed-off-by: Kyle J. McKay --- install.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/install.sh b/install.sh index 35abb48..51eb2b7 100755 --- a/install.sh +++ b/install.sh @@ -575,6 +575,23 @@ case "$cfg_cgiroot" in /*) :;; *) exit 1 esac +echo "*** Verifying installation preconditions..." + +# Make sure Markdown.pm is present and use'able +if + ! [ -e Markdown.pm ] || ! [ -f Markdown.pm ] || ! [ -s Markdown.pm ] || + ! mdoutput="$("$perlbin" 2>/dev/null -I"$PWD" -MMarkdown=Markdown,ProcessRaw -e \ + 'use strict; use warnings; print Markdown("_test_ **this**"); exit 0;')" +then + echo "ERROR: markdown.git is not checked out! Did you _REALLY_ read INSTALL?" >&2 + exit 1 +fi +# And that it at least appears to function properly +if [ "$mdoutput" != '

test this

' ]; then + echo "ERROR: markdown.git verification test failed -- Markdown function does not work" >&2 + exit 1 +fi + # return the input with trailing slashes stripped but return "/" for all "/"s striptrsl() { [ -n "$1" ] || return 0 -- 2.11.4.GIT