-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathget-release-server.sh
More file actions
executable file
·37 lines (33 loc) · 1.09 KB
/
get-release-server.sh
File metadata and controls
executable file
·37 lines (33 loc) · 1.09 KB
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
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 OC_VERSION"
echo " eg: $0 r/16.x -> Returns the current correct server for r/16.x"
exit 1
fi
git clone https://github.com/opencast/opencast.git ~/opencast
cd ~/opencast
#Get the list of *all* branches in the format remotes/origin/r/N.m
#grep for r/N.x
#then use cut to remove remotes/origin
#then use sort, with a field delimiter of '/', sorting on the *second* key in 'n'umeric 'r'evers order
#then only consider the first 3 entries
ary=( develop `git branch -a | grep origin | grep 'r/[0-9]*.x' | cut -f 3- -d '/' | sort -t '/' -k 2nr | head -n 3` )
#Iterate through the array above.
#If the script input matches the first item, spit out develop
#If the script iput matches hte second item... etc
#If it doesn't match anything, then don't say anything
for i in "${!ary[@]}"
do
if [[ "${ary[i]}" = "$1" ]]; then
if [[ $i -eq 0 ]]; then
echo "develop.opencast.org"
exit 0
elif [[ $i -eq 1 ]]; then
echo "stable.opencast.org"
exit 0
elif [[ $i -eq 2 ]]; then
echo "legacy.opencast.org"
exit 0
fi
fi
done