From 34944f8d2676909c7b3ea68cd4da09cbd066caff Mon Sep 17 00:00:00 2001 From: BT Date: Fri, 10 Jul 2020 19:50:56 +0700 Subject: [PATCH] Dependency checks (#23) https://github.com/getumbrel/umbrel/pull/23 --- configure-box.sh | 11 +++++++++++ install-box.sh | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/configure-box.sh b/configure-box.sh index ddada7a..59d0977 100755 --- a/configure-box.sh +++ b/configure-box.sh @@ -16,6 +16,17 @@ if [ ! $(uname -s) == "Linux" ]; then exit 1 fi +check_dependencies () { + for cmd in "$@"; do + if ! command -v $cmd >/dev/null 2>&1; then + echo "This script requires \"${cmd}\" to be installed" + exit 1 + fi + done +} + +check_dependencies wget docker docker-compose + echo "Start box configuration" echo "Installing RPCAuth.py and configuring secrets" cd bin/ diff --git a/install-box.sh b/install-box.sh index 271cb46..9c60000 100644 --- a/install-box.sh +++ b/install-box.sh @@ -11,6 +11,17 @@ # Install the docker-compose box to the current working directory # Pre-requisites: git +check_dependencies () { + for cmd in "$@"; do + if ! command -v $cmd >/dev/null 2>&1; then + echo "This script requires \"${cmd}\" to be installed" + exit 1 + fi + done +} + +check_dependencies git + echo "Cloning to current working directory from github..." git init git remote add origin https://github.com/getumbrel/umbrel.git