This repository has been archived by the owner on Jul 29, 2020. It is now read-only.
forked from QubitProducts/bamboo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·84 lines (73 loc) · 2.06 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
#!/bin/bash
set -e
set -u
name=bamboo
version=${_BAMBOO_VERSION:-"1.0.0"}
description="Bamboo is a DNS based HAProxy auto configuration and auto service discovery for Mesos Marathon."
url="https://github.com/QuBitProducts/bamboo"
arch="all"
section="misc"
license="Apache Software License 2.0"
package_version=${_BAMBOO_PKGVERSION:-"-1"}
origdir="$(pwd)"
workspace="builder"
pkgtype=${_PKGTYPE:-"deb"}
builddir="build"
installdir="opt"
outputdir="output"
function cleanup() {
cd ${origdir}/${workspace}
rm -rf ${name}*.{deb,rpm}
rm -rf ${builddir}
}
function bootstrap() {
cd ${origdir}/${workspace}
# configuration directory
mkdir -p ${builddir}/${name}/${installdir}/bamboo/config
pushd ${builddir}
}
function build() {
# Prepare binary at /opt/bamboo/bamboo
cp ${origdir}/bamboo ${name}/${installdir}/bamboo/bamboo
chmod 755 ${name}/${installdir}/bamboo/bamboo
# Link default confiugration
cp -rp ${origdir}/config/* ${name}/${installdir}/bamboo/config/.
# Distribute UI webapp
mkdir -p ${name}/${installdir}/bamboo/webapp
cp -rp ${origdir}/webapp/dist ${name}/${installdir}/bamboo/webapp/dist
cp -rp ${origdir}/webapp/fonts ${name}/${installdir}/bamboo/webapp/fonts
cp ${origdir}/webapp/index.html ${name}/${installdir}/bamboo/webapp/index.html
# Versioning
echo ${version} > ${name}/${installdir}/bamboo/VERSION
pushd ${name}
}
function mkdeb() {
# rubygem: fpm
fpm -t ${pkgtype} \
-n ${name} \
-v ${version}${package_version} \
--description "${description}" \
--url="${url}" \
-a ${arch} \
--category ${section} \
--vendor "Qubit" \
--after-install ../../build.after-install \
--after-remove ../../build.after-remove \
--before-remove ../../build.before-remove \
-m "${USER}@${HOSTNAME}" \
--deb-upstart ../../bamboo-server \
--license "${license}" \
--prefix=/ \
-s dir \
-- .
mkdir -p ${origdir}/${outputdir}
mv ${name}*.${pkgtype} ${origdir}/${outputdir}/
popd
}
function main() {
cleanup
bootstrap
build
mkdeb
}
main