-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·194 lines (165 loc) · 5.53 KB
/
build.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/bin/bash
# Insipired by:
# https://stash.adaptavist.com/projects/ATB/repos/fpm-builder/browse/build-crowd.sh
# https://bitbucket.org/Adaptavist/fpm-puppet
#
# https://systembash.com/simple-guide-to-signing-rpms-with-fpm/ - Quick guide to signing with FPM
#
# This Script requires the following packages
# To Build the RPM:
# fpm - gem
# rpm-build - rpm
# To Sign the RPM:
# rpm-sign - rpm
# gpg - rpm
# Pull in any RVM variables for Ruby to work
[ -r /etc/profile.d/rvm.sh ] && . /etc/profile.d/rvm.sh
# Exit on error
#set -e
# Treat using unset variables as an error
#set -u
cd $( dirname $0 )
for bin in fpm git ; do
if ! type ${bin} >/dev/null ; then
echo
echo "${bin} command not found please install" >&2
echo
exit 10
fi
done
INSTALL_PREFIX="/usr/"
ITERATION=$( git rev-parse --short HEAD )
function usage () {
echo "$( basename $0 ) --version <version> [--install-prefix] [--iteration]"
echo ""
echo "These parameters get passed directly to fpm in order to build the packages."
echo "See fpm help for information on these parameters."
}
# Basic option handling
while (( $# > 0 ))
do
opt="$1"
case $opt in
--help)
usage
exit 0
;;
--version)
VERSION="$2"
shift
;;
--install-prefix)
INSTALL_PREFIX="$2"
shift
;;
--iteration)
ITERATION="$2"
shift
;;
--*)
echo "Invalid option: '$opt'"
usage
exit 1
;;
*)
# end of long options
break
;;
esac
shift # do this after the case statements, so the first param is not lost!
done
if [[ -z "${VERSION:-}" ]]; then
echo "Invalid usage: version must be provided"
usage
exit 10
fi
function build-package () {
# TODO: Check dependancies for: Augeas (augeas-tools), bsdtar on CentOS
local PKG_NAME=$1
local DIRS=$2
local DEPS=$3
local DESC=$4
for pkg in rpm deb; do
if [[ ${pkg} == deb ]]; then
ADDITIONAL_DEPS="-d augeas-tools -d dos2unix"
else
ADDITIONAL_DEPS="-d augeas -d dos2unix"
fi
# this step requires that ~/rpmmacros be configured with details of the desired GPG key
fpm \
-s dir \
-t ${pkg} \
--rpm-sign \
-n ${PKG_NAME} \
--prefix ${INSTALL_PREFIX} \
--version ${VERSION} \
--iteration ${ITERATION} \
--license "Commercial" \
--vendor "Adaptavist" \
-a "all" \
--url "http://www.adaptavist.com/" \
--description "${DESC}" \
-m "[email protected]" \
-d "tar" \
${DEPS} \
${ADDITIONAL_DEPS} \
$( echo ${DIRS} )
done
}
build-package avst-app \
"bin share/avst-app/doc share/avst-app/upstart share/avst-app/lib/common share/avst-app/systemd" \
"" \
"Adaptavist application management scripts - Common"
build-package avst-app-crowd \
"share/avst-app/lib/product/crowd" \
"-d avst-app -d avst-app-atlassian -d avst-app-tomcat" \
"Adaptavist application management scripts - Crowd"
build-package avst-app-bitbucket \
"share/avst-app/lib/product/bitbucket" \
"-d avst-app -d avst-app-atlassian -d avst-app-tomcat" \
"Adaptavist application management scripts - Bitbucket"
build-package avst-app-bamboo \
"share/avst-app/lib/product/bamboo" \
"-d avst-app -d avst-app-atlassian -d avst-app-tomcat" \
"Adaptavist application management scripts - Bamboo"
build-package avst-app-bamboo-agent \
"share/avst-app/lib/product/bamboo_agent" \
"-d avst-app" \
"Adaptavist application management scripts - Bamboo Agent"
build-package avst-app-fisheye \
"share/avst-app/lib/product/fisheye" \
"-d avst-app" \
"Adaptavist application management scripts - Fisheye"
build-package avst-app-jira \
"share/avst-app/lib/product/jira" \
"-d avst-app -d avst-app-atlassian -d avst-app-tomcat" \
"Adaptavist application management scripts - JIRA"
build-package avst-app-artifactory \
"share/avst-app/lib/product/artifactory" \
"-d avst-app -d avst-app-tomcat" \
"Adaptavist application management scripts - Artifactory"
build-package avst-app-tomcat \
"share/avst-app/lib/tomcat" \
"-d avst-app" \
"Adaptavist application management scripts - Tomcat"
build-package avst-app-atlassian \
"share/avst-app/lib/atlassian" \
"-d avst-app -d avst-app-tomcat" \
"Adaptavist application management scripts - Atlassian"
build-package avst-app-coverity \
"share/avst-app/lib/product/coverity" \
"-d avst-app -d avst-app-tomcat" \
"Adaptavist application management scripts - Coverity"
build-package avst-app-confluence \
"share/avst-app/lib/product/confluence" \
"-d avst-app -d avst-app-atlassian -d avst-app-tomcat" \
"Adaptavist application management scripts - Confluence"
build-package avst-app-sonarqube \
"share/avst-app/lib/product/sonarqube" \
"-d avst-app" \
"Adaptavist application management scripts - SonarQube"
build-package avst-app-synchrony \
"share/avst-app/lib/product/synchrony share/avst-app/scripts/synchrony" \
"-d avst-app" \
"Adaptavist application management scripts - Synchrony"
exit 0