From e38c87eab91ba6dfa1c8ac0d3096fbb7fb2d0e6e Mon Sep 17 00:00:00 2001 From: Gary Sneed Date: Fri, 25 Oct 2024 21:40:39 -0700 Subject: Added dependency checks --- README.md | 2 +- get_version.sh | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f6937c..eb8cdf9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The other options for Minecraft launchers are massive (e.g. MultiMC) and like ma - OpenBSD ## Dependencies -* `jq`, `curl` and `nickle` - On Debian, you can install with `sudo apt install jq curl nickle`. +* `jq` (1.7 and later), `curl` and `nickle` - On Debian, you can install with `sudo apt install curl nickle` and get `jq` from here: https://jqlang.github.io/jq/download/ - The version of `jq` shipped with a lot of distributions is apparently very old; you need 1.7 and later. * `uname`, `xargs`, `ls`, `cat`, `tr`, `mkdir`, `tee`, `dirname`, `sha1sum`, `sed`, `basename`, `date`, `xargs` - Listed for good measure, but you should almost certainly have all of these unless you are using an incomplete distribution/operating system. * A POSIX-compatible shell - If you are on Linux or a UNIX-based operating system, you almost certainly have one. * A Java runtime - Check with your distribution for installing. On Debian-based systems, the package is usually `default-jre` or `openjdk--jre`. diff --git a/get_version.sh b/get_version.sh index cae7101..c413459 100755 --- a/get_version.sh +++ b/get_version.sh @@ -1,5 +1,28 @@ #!/usr/bin/env sh +# Check for packages +JQ_VERSION=$(jq --version 2>/dev/null) +if [[ ${JQ_VERSION} == 'jq-1.3' || ${JQ_VERSION} == 'jq-1.4' || ${JQ_VERSION} == 'jq-1.5' || ${JQ_VERSION} == 'jq-1.6' ]]; then + echo 'ERROR: installed jq version is too old; must be at least 1.7' + exit 1 +elif [ -z ${JQ_VERSION} ]; then + echo 'ERROR: please install jq 1.7+' + exit 1 +fi + +NICKLE_LOCATION=$(which nickle) +CURL_LOCATION=$(which curl) + +if [ ! -f "${NICKLE_LOCATION}" ]; then + echo "ERROR: please install Nickle" + exit 1 +fi + +if [ ! -f "${CURL_LOCATION}" ]; then + echo "ERROR: please install cURL" + exit 1 +fi + # Only accepts 1 argument: the Minecraft version to download LOOOKING_FOR= if [ -z "${1}" ]; then -- cgit v1.2.3