From 0ad434a69a6719952ee9ea8109609187d7e6128f Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Fri, 23 Nov 2018 16:58:17 +0100 Subject: 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 --- bin/setup | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'bin/setup') 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 < --- bin/setup | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index 0a48ba8c..c73aeeea 100755 --- a/bin/setup +++ b/bin/setup @@ -21,18 +21,22 @@ EOF exit 1 fi -if version_lt "$(yarn --version)" '1.3.2'; then +if version_lt "$(yarn --version)" '1.22.0'; then cat < --- bin/setup | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index c73aeeea..238b42e9 100755 --- a/bin/setup +++ b/bin/setup @@ -13,10 +13,11 @@ fi if ! type yarn > /dev/null then cat << EOF -yarn is not installed, please install Node.js, npm and yarn. -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 +FATAL: Yarn could not be found. + +Please follow the official installation instructions at +https://classic.yarnpkg.com/en/docs/install +and try again. EOF exit 1 fi @@ -25,7 +26,7 @@ if version_lt "$(yarn --version)" '1.22.0'; then cat < --- bin/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index 238b42e9..926c8cbc 100755 --- a/bin/setup +++ b/bin/setup @@ -26,7 +26,7 @@ if version_lt "$(yarn --version)" '1.22.0'; then cat < --- bin/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index 926c8cbc..0cd46b83 100755 --- a/bin/setup +++ b/bin/setup @@ -2,7 +2,7 @@ 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"; } +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 -- cgit v1.2.3 From ac7dd2982f53de30f428b57edf54c225b4bd91c5 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Tue, 17 Nov 2020 21:29:54 +0100 Subject: Fix inconsistent spacing in bin/setup Signed-off-by: David Mehren --- bin/setup | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'bin/setup') diff --git a/bin/setup b/bin/setup index 0cd46b83..0f1edca0 100755 --- a/bin/setup +++ b/bin/setup @@ -10,8 +10,7 @@ if [ -d .git ]; then cd "$(git rev-parse --show-toplevel)" fi -if ! type yarn > /dev/null -then +if ! type yarn > /dev/null; then cat << EOF FATAL: Yarn could not be found. @@ -23,7 +22,7 @@ EOF fi if version_lt "$(yarn --version)" '1.22.0'; then - cat <