bootstrap: check for the shell builtin we use and exit if it doesn't
authorng0 <ng0@n0.is>
Wed, 27 Nov 2019 21:55:31 +0000 (21:55 +0000)
committerng0 <ng0@n0.is>
Wed, 27 Nov 2019 21:55:31 +0000 (21:55 +0000)
exist.

bootstrap

index e2654d9bd9b5aab5c1811803438cb1fba8dc8d41..06a82ddfc45ec3986985d22bf9508536b31b357c 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -18,6 +18,17 @@ cleanup()
     rm -rf libltdl
 }
 
+errmsg=''
+
+# Check if shell supports builtin 'type'.
+if test -z "$errmsg"; then
+    if ! (eval 'type type') >/dev/null 2>&1
+    then
+        errmsg='Shell does not support type builtin'
+        exit 1
+    fi
+fi
+
 # This is more portable than `which' but comes with
 # the caveat of not(?) properly working on busybox's ash:
 existence()