diff --git a/copy.sh b/copy.sh index 7f40597..5f0d8ab 100755 --- a/copy.sh +++ b/copy.sh @@ -6,15 +6,21 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) FAKE_HOME="$SCRIPT_DIR/fake_home" export f="$FAKE_HOME" -if ! command -v wget &> /dev/null; then - echo "wget must be installed!" - exit 1 -fi +function require { + local success=true + for comm in "$@"; do + if ! command -v "$comm" &> /dev/null; then + echo "$comm must be installed!" + success=false + fi + done + if ! $success; then + echo "Missing copy.sh dependencies! Exiting!" + exit 1 + fi +} -if ! command -v curl &> /dev/null; then - echo "curl must be installed!" - exit 1 -fi +require git wget curl find jq gron mkdir -p "$HOME/.tmp" || exit 1