Browse Source

check requirements before unpack

Tobias Simetsreiter 4 years ago
parent
commit
76d9646734
1 changed files with 10 additions and 0 deletions
  1. 10 0
      sharxz

+ 10 - 0
sharxz

@@ -184,6 +184,16 @@ shift $((OPTIND -1))
 SHARPARSEREOF
 
 read -r -d '' PREPSHAR <<'PREPSHAREOF'
+REQUIREMENTS=(
+    "xz"
+    "tar"
+    "base64"
+    "mkfifo"
+    "mktemp"
+)
+for REQ in "${REQUIREMENTS[@]}"; do
+    [ -x "$(which $REQ 2> /dev/null)" ] || { echo "This sharxz needs $REQ in PATH." 1>&2 && exit 1; }
+done
 $DEBUG && set -x
 
 cleanup(){