summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSheogorath2018-11-23 16:58:17 +0100
committerDavid Mehren2020-11-17 20:46:42 +0100
commit0ad434a69a6719952ee9ea8109609187d7e6128f (patch)
treeac60c1df023ec621cfbdbddc66add6afc2b597fc
parented98084c1362a3b81f67753c913e9d695cbb4e5a (diff)
Add some version checks to setup script
There are some distros out there, shipping quite outdated packages with them, which results in weird issues. Let's check that we have a more or less up to date version of node and yarn installed. This patch adds those checks and this way should provide some helpful error messages to people who try to install CodiMD. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
-rwxr-xr-xbin/setup20
1 files changed, 19 insertions, 1 deletions
diff --git a/bin/setup b/bin/setup
index 2fcc65d6..0a48ba8c 100755
--- a/bin/setup
+++ b/bin/setup
@@ -2,6 +2,8 @@
set -e
+version_lt() { test "$(printf '%s\n' "$@" | { [ "$(uname)" = "Linux" ] && sort -V || sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n; } | tail -n 1)" != "$1"; }
+
# run command at repo root
CURRENT_PATH=$PWD
if [ -d .git ]; then
@@ -16,7 +18,23 @@ Read more on Node.js official website: https://nodejs.org
And for yarn package manager at: https://yarnpkg.com/en/
Setup will not be run
EOF
- exit 0
+ exit 1
+fi
+
+if version_lt "$(yarn --version)" '1.3.2'; then
+ cat <<EOF
+Your yarn version is outdated. Please upgrade to a version
+newer than 1.3.2.
+EOF
+ exit 1
+fi
+
+if version_lt "$(node --version)" 'v6.0.0'; then
+ cat <<EOF
+Your node version is outdated. Please upgrade to version 6
+or higher. (Version 8 or higher is recommended)
+EOF
+ exit 1
fi
echo "copy config files"