-
Notifications
You must be signed in to change notification settings - Fork 0
/
nightly.sh
123 lines (81 loc) · 2.35 KB
/
nightly.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash
source bash-toolbox/init.sh
include app.server.version.AppServerVersion
include calendar.util.CalendarUtil
include command.validator.CommandValidator
include curl.util.CurlUtil
include file.util.FileUtil
include help.message.HelpMessage
include logger.Logger
include props.reader.util.PropsReaderUtil
include repo.Repo
@description downloads_a__tomcat_snapshot_bundle_for_the_specified_branch
get(){
if [[ ${branch} == *-private || ${branch} == ee-* ]]; then
local propKey=snapshot.private.url
else
local propKey=snapshot.public.url
fi
local baseUrl=$(PropsReaderUtil getValue ${snapshotProps} ${propKey})
cd ${bundleDir}
${_log} info "downloading_${branch}_snapshot_bundle..."
local url=$(echo ${baseUrl} | \
sed "s#https\?://#http://mirrors/#g")/snapshot-${branch}/latest
local snapshotFile=liferay-portal-${appServer}-${branch}.7z
CurlUtil getFile ${url}/${snapshotFile}
local appServerVersion=$(AppServerVersion
getAppServerVersion ${appServer} ${branch})
local appServerRelativeDir=${appServer}-${appServerVersion}
local appServerDir=${bundleDir}/${appServerRelativeDir}
local filePaths=(
data
deploy
logs
license
osgi
${appServerRelativeDir}
tools
work
.githash
.liferay-home
)
${_log} info "cleaning_up_bundle_files..."
rm -rf ${filePaths[@]}
${_log} info "extracting_${branch}_snapshot_bundle..."
7z x ${snapshotFile} > /dev/null
for filePath in ${filePaths[@]}; do
if [[ -e liferay-portal-${branch}/${filePath} ]]; then
mv liferay-portal-${branch}/${filePath} .
fi
done
rm -rf liferay-portal-${branch} ${snapshotFile}
${_log} info "zipping_up_${branch}_snapshot_bundle..."
local zipFile=liferay-portal-${appServer}-${branch}-$(CalendarUtil
getTimestamp date)$(CalendarUtil getTimestamp clock).7z
filePaths+=(portal-ext.properties)
FileUtil compress ${zipFile} filePaths
${_log} info "completed."
}
main(){
local appServer="tomcat"
local baseDir=$(pwd)
local branch=$(Repo getBranch $@)
local bundleDir=$(Repo getBundleDir ${branch})
local snapshotProps=build.snapshot.properties
local _log="Logger log"
if [[ ! ${1} ]]; then
HelpMessage printHelpMessage
return
fi
until [[ ! ${1} ]]; do
if [[ ${1} == ${appServer} || ${1} == ${branch} ]]; then
shift
else
cd ${baseDir}
CommandValidator validateCommand ${0} ${1}
${1}
fi
shift
done
}
main $@