-
Notifications
You must be signed in to change notification settings - Fork 6
/
version_verifier.sh
executable file
·70 lines (68 loc) · 1.37 KB
/
version_verifier.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
#!/bin/bash
check_if_legacy() {
case "$1" in
4\.0\.1[7-9]*)
return 1
;;
4\.0\.[2-9][0-9]*)
return 1
;;
4\.0\.1[0-6]*)
return 2
;;
4\.0\.[1-9][^0-9]*)
return 2
;;
4\.0\.[1-9])
return 2
;;
4\.[1-9][0-9]*)
return 0
;;
4\.[1-5]\.*)
return 2
;;
4\.6\.[2-8]*)
return 2
;;
4\.6\.[0-1])
return 2
;;
4\.6\.9)
return 0
;;
4\.6\.1[0-9])
return 0
;;
4\.1[^0-9]*)
return 1
;;
4\.[7-9]*)
return 0
;;
*)
return 2
exit
;;
esac
}
tags=$(git ls-remote --tags https://github.com/pcengines/coreboot.git)
for tag in $tags;
do
if [[ $tag =~ refs/tags/v. ]]; then
tag="${tag##*refs/tags/}";
tag="${tag%^*}";
if [[ ${tag:0:1} == "v" ]] ; then tag=${tag:1}; fi
check_if_legacy $tag
st=$?
if [[ $st == 1 ]]; then
echo "$tag is LEGACY"
elif [[ $st == 0 ]]; then
echo "$tag is MAINLINE"
elif [[ $st == 2 ]]; then
echo "$tag is UNSUPPORTED"
else
echo "ERROR: Tag not recognized $tag"
fi
fi
done