diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-07-10 15:01:05 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-07-10 15:01:05 +0200 |
commit | 7a214f746bf420defbf17fa218d90d6233551bf8 (patch) | |
tree | 3793dc0ae572d4bbde160d9c8949e9e27b92f709 | |
parent | ad0997adfb9e1e3b1ff54338d7558cf7b18440ea (diff) | |
download | PeerTube-7a214f746bf420defbf17fa218d90d6233551bf8.tar.gz PeerTube-7a214f746bf420defbf17fa218d90d6233551bf8.tar.zst PeerTube-7a214f746bf420defbf17fa218d90d6233551bf8.zip |
Fix upgrade peertube script (bad semver comparison)
-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 |