-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunDownload.sh
executable file
·57 lines (47 loc) · 922 Bytes
/
runDownload.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
#!/bin/bash
tmp="sonar-application-"
# get download name
cd ~/Downloads
file=( $(ls sonar-application*) )
if [ -z "$file" ]
then
file=( $(ls sonarqube-developer*) )
tmp="sonarqube-developer-"
fi
if [ -z "$file" ]
then
file=( $(ls sonarqube-enterprise*) )
tmp="sonarqube-enterprise-"
fi
if [ -z "$file" ]
then
file=( $(ls sonarqube-datacenter*) )
tmp="sonarqube-datacenter-"
fi
if [ -z "$file" ]
then
file=( $(ls sonarcloud*) )
tmp="sonarcloud-"
fi
if [ -z "$file" ]
then
echo No downloaded version found.
exit;
fi
# calculate version
ver=$file
len=${#tmp}
ver=${ver:$len}
len=${#ver}-4 #-4 for .zip
ver=${ver:0:$len}
# put download in place, expand, kill zip
cd
mv Downloads/${file} ~/sonarVersions/.
cd sonarVersions
unzip $file
rm $file
# start downloaded version
mv default.txt default.bak
echo $ver > default.txt
touch sonarqube-${ver}/logs/sonar.log
/bin/bash ~/scripts/start.sh