]>
Commit | Line | Data |
---|---|---|
aa77e1c2 | 1 | #!/bin/bash |
9f540774 | 2 | |
7a214f74 C |
3 | verlte() { |
4 | [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ] | |
5 | } | |
6 | ||
7 | nodeMinVersion="6.0.0" | |
85ec3eb7 | 8 | npmMinVersion="3.0.0" |
9f540774 | 9 | |
7a214f74 C |
10 | actualNodeVersion=$(node --version | tr -d "v") |
11 | actualNpmVersion=$(npm --version) | |
12 | ||
13 | if verlte $actualNodeVersion $nodeMinVersion; then | |
85ec3eb7 C |
14 | echo 'You need node >= 6' |
15 | exit 0 | |
16 | fi | |
17 | ||
7a214f74 | 18 | if verlte $actualNpmVersion $npmMinVersion; then |
85ec3eb7 C |
19 | echo 'You need npm >= 3' |
20 | exit 0 | |
21 | fi | |
9f540774 | 22 | |
94f12771 BF |
23 | if ! which yarn > /dev/null; then |
24 | echo 'You need yarn' | |
25 | exit 0 | |
26 | fi | |
27 | ||
d16a0ad8 | 28 | if pgrep peertube > /dev/null; then |
d8755eed | 29 | echo 'PeerTube is running, please shut it off before upgrading' |
9f540774 C |
30 | exit 0 |
31 | fi | |
32 | ||
85ec3eb7 C |
33 | git pull origin $(git rev-parse --abbrev-ref HEAD) || exit -1 |
34 | ||
62be8e11 | 35 | yarn install --pure-lockfile |
9f540774 C |
36 | npm run build |
37 | ||
407c4473 | 38 | echo -e "\n\nUpgrade finished! You can restart PeerTube that may run the migration scripts." |