-
Notifications
You must be signed in to change notification settings - Fork 119
/
support.sh
99 lines (90 loc) · 3.29 KB
/
support.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
set -o errexit
set -o pipefail
set -o nounset
set -o allexport
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
do_sed () {
if [ "$(uname)" == "Darwin" ]; then # Mac
sed -i '' -e "$1" "$2"
else # Linux
sed --in-place "$1" "$2"
fi
}
# Reverse the file from filename or stdin
do_tac () {
if [ "$(uname)" == "Darwin" ]; then # Mac
# macOS doesn't have tac, so we use tail -r
if (( $# == 0 )) ; then
tail -r < /dev/stdin
else
tail -r "$1"
fi
else # Linux
# linux doesn't have -r option for tail
if (( $# == 0 )) ; then
tac < /dev/stdin
else
tac "$1"
fi
fi
}
set_node_version() {
# Versions 1.9 through 2.2 need Node 12.22.1
if [[ "$1" == 1.9* ]] || \
[[ "$1" == 1.10* ]] || \
[[ "$1" == 1.11* ]] || \
[[ "$1" == 1.12* ]] || \
[[ "$1" == 2.0 ]] || \
[[ "$1" == 2.1 ]] || \
[[ "$1" == 2.1.1 ]] || \
[[ "$1" == 2.2 ]]; then node_version='12.22.1'
elif [[ "$1" == 2.2.1 ]]; then node_version='12.22.2'
elif [[ "$1" == 2.2.2 ]]; then node_version='12.22.4'
elif [[ "$1" == 2.2.3 ]]; then node_version='12.22.5'
elif [[ "$1" == 2.2.4 ]]; then node_version='12.22.5'
elif [[ "$1" == 2.3 ]]; then node_version='14.17.1'
elif [[ "$1" == 2.3.1 ]]; then node_version='14.17.3'
elif [[ "$1" == 2.3.2 ]]; then node_version='14.17.3'
elif [[ "$1" == 2.3.3 ]]; then node_version='14.17.4'
elif [[ "$1" == 2.3.4 ]]; then node_version='14.17.4'
elif [[ "$1" == 2.3.5 ]]; then node_version='14.17.5'
elif [[ "$1" == 2.3.6 ]]; then node_version='14.17.6'
elif [[ "$1" == 2.3.7 ]]; then node_version='14.17.6'
elif [[ "$1" == 2.4 ]]; then node_version='14.17.6'
elif [[ "$1" == 2.5 ]]; then node_version='14.18.1'
# Versions from 2.5.1 to 2.5.5 are unsupported because the Fibers version is missing binaries
elif [[ "$1" == 2.5.6 ]]; then node_version='14.18.3'
elif [[ "$1" == 2.5.7 ]]; then node_version='14.19.3'
elif [[ "$1" == 2.5.8 ]]; then node_version='14.19.3'
elif [[ "$1" == 2.6 ]]; then node_version='14.18.3'
elif [[ "$1" == 2.6.1 ]]; then node_version='14.18.3'
elif [[ "$1" == 2.7 ]]; then node_version='14.19.1'
elif [[ "$1" == 2.7.1 ]]; then node_version='14.19.1'
elif [[ "$1" == 2.7.2 ]]; then node_version='14.19.1'
elif [[ "$1" == 2.7.3 ]]; then node_version='14.19.3'
elif [[ "$1" == 2.8.0 ]]; then node_version='14.20.1'
elif [[ "$1" == 2.8.1 ]]; then node_version='14.21.1'
elif [[ "$1" == 2.9.0 ]]; then node_version='14.21.1'
elif [[ "$1" == 2.9.1 ]]; then node_version='14.21.2'
elif [[ "$1" == 2.10.0 ]]; then node_version='14.21.2'
elif [[ "$1" == 2.11.0 ]]; then node_version='14.21.3'
elif [[ "$1" == 2.12 ]]; then node_version='14.21.3'
elif [[ "$1" == 2.13 ]]; then node_version='14.21.4'
elif [[ "$1" == 2.13.1 ]]; then node_version='14.21.4'
elif [[ "$1" == 2.13.3 ]]; then node_version='14.21.4'
elif [[ "$1" == 2.14 ]]; then node_version='14.21.4'
elif [[ "$1" == 2.15 ]]; then node_version='14.21.4'
elif [[ "$1" == 2.16 ]]; then node_version='14.21.4'
elif [[ "$1" == 3.0.1 ]]; then node_version='20.15.1'
elif [[ "$1" == 3.0.2 ]]; then node_version='20.15.1'
elif [[ "$1" == 3.0.3 ]]; then node_version='20.17.0'
elif [[ "$1" == 3.0.4 ]]; then node_version='20.18.0'
fi # End of versions
}
# Use printf to get appropriate version string for comparison
get_version_string() {
printf "%02d%02d%02d" $(echo "$1" | tr '.' ' ');
}