diff options
Diffstat (limited to 'scripts/upgrade-peertube.sh')
-rwxr-xr-x | scripts/upgrade-peertube.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/upgrade-peertube.sh b/scripts/upgrade-peertube.sh index ff6dce94f..f7b856470 100755 --- a/scripts/upgrade-peertube.sh +++ b/scripts/upgrade-peertube.sh | |||
@@ -1,14 +1,21 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | nodeMinVersion="v6.0.0" | 3 | verlte() { |
4 | [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] | ||
5 | } | ||
6 | |||
7 | nodeMinVersion="6.0.0" | ||
4 | npmMinVersion="3.0.0" | 8 | npmMinVersion="3.0.0" |
5 | 9 | ||
6 | if [[ $(node --version) < $nodeMinVersion ]]; then | 10 | actualNodeVersion=$(node --version | tr -d "v") |
11 | actualNpmVersion=$(npm --version) | ||
12 | |||
13 | if verlte $actualNodeVersion $nodeMinVersion; then | ||
7 | echo 'You need node >= 6' | 14 | echo 'You need node >= 6' |
8 | exit 0 | 15 | exit 0 |
9 | fi | 16 | fi |
10 | 17 | ||
11 | if [[ $(npm --version) < $npmMinVersion ]]; then | 18 | if verlte $actualNpmVersion $npmMinVersion; then |
12 | echo 'You need npm >= 3' | 19 | echo 'You need npm >= 3' |
13 | exit 0 | 20 | exit 0 |
14 | fi | 21 | fi |