about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-03 18:40:48 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-03 18:40:48 +0200
commit925feeeebd03024ab518c07b578c1892370ee985 (patch)
tree8f257f502c6ac113f500783c803cd0be9a05c93f
parentfix(common/init): Don't try to assign the reuse template, replace it instead ... (diff)
downloadflake-templates-925feeeebd03024ab518c07b578c1892370ee985.tar.gz
flake-templates-925feeeebd03024ab518c07b578c1892370ee985.zip
fix(common/init): State which binaries are required to run it
-rw-r--r--common/init17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/init b/common/init
index b1d2eb4..5dcc67b 100644
--- a/common/init
+++ b/common/init
@@ -14,6 +14,13 @@ remove_self() {
     rm "$(realpath "$0")"
     rm "$(realpath "$(dirname "$0")")/shell_line_editor.sh"
 }
+require() {
+    program="$1"
+    if ! command -v "$program" >/dev/null; then
+        echo "Please install '$program' for this init script to work." 1>&2
+        exit 1
+    fi
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -47,6 +54,16 @@ prompt() {
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
 }
 
+require git
+
+require jq
+require curl
+
+require fd
+require mv
+require sed
+require chmod
+
 git init
 
 # necessary meta data