Browse Source

adding dependency check; improve help display

mxmehl 3 years ago
parent
commit
3866e8752a
1 changed files with 24 additions and 3 deletions
  1. 24
    3
      fsfe-preview.sh

+ 24
- 3
fsfe-preview.sh View File

@@ -25,6 +25,24 @@
25 25
 #  
26 26
 #######################################################################
27 27
 
28
+# Check dependencies (stolen from build_main.sh)
29
+deperrors=''
30
+for depend in realpath rsync xsltproc xmllint sed find egrep grep wc make tee date iconv; do
31
+  if ! which "$depend" >/dev/null 2>&1; then
32
+    deperrors="$depend $deperrors"
33
+  fi
34
+done
35
+if [ -n "$deperrors" ]; then
36
+  printf '\033[1;31m'
37
+  cat <<-EOF
38
+	The build script depends on some other programs to function.
39
+	Not all of those programs could be located on your system.
40
+	Please use your package manager to install the following programs:
41
+	EOF
42
+  printf '\n\033[0;31m%s\n' "$deperrors"
43
+  exit 1
44
+fi >>/dev/stderr
45
+
28 46
 ROOT=$(dirname "$(readlink -f "$0")")
29 47
 if [ ! -e "$ROOT"/config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi
30 48
 source "$ROOT"/config.cfg
@@ -37,12 +55,15 @@ if [ "$1" = "" ]; then
37 55
   echo "Usage: "
38 56
   echo
39 57
   echo "$self file.en.xhtml"
40
-  echo "   -- build single XHTML file from your source to the local web directory"
41
-  echo "      the destination will be on the same relative level of the selected XHTML file"
58
+  echo "   -- build single XHTML file from your source to the local web "
59
+  echo "      directory"
60
+  echo "      The destination will be on the same relative level of the "
61
+  echo "      selected XHTML file"
42 62
   echo "      If not a XHTML file, it will be copied to the web directory"
43 63
   echo
44 64
   echo "$self --copy picture.png look/style.css"
45
-  echo "   -- Just copies several files to the local web directory without even trying to build them"
65
+  echo "   -- Just copies several files to the local web directory without "
66
+  echo "      even trying to build them"
46 67
   exit 0
47 68
 fi
48 69
 

Loading…
Cancel
Save