This repository has been archived by the owner on Feb 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_prometheus.sh
executable file
·71 lines (54 loc) · 1.81 KB
/
build_prometheus.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
#!/usr/bin/env bash
# Copyright 2015 The Prometheus Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
version=$1
os=$2
arch=$3
base_url=https://github.com/prometheus/prometheus/releases/download
base_dir=$( cd "$(dirname "$0")" && pwd )/prometheus
echo $base_dir
build() {
version=$1
os=$2
arch=$3
cd $base_dir
src_dir=$base_dir/source/v$version
rm -rf prometheus/source/v$version
mkdir -p $base_dir/builds
mkdir -p $src_dir
cd $src_dir
curl -L $base_url/$version/prometheus-$version.$os-$arch.tar.gz | tar -xzv --strip 1
cd $base_dir
# If the package files already exist, fpm will fail.
rm -f builds/prometheus_0.16.0rc2_amd64.deb
rm -f builds/prometheus-0.16.0rc2-1.x86_64.rpm
fpm -s dir -t deb -p builds \
-a $arch \
-v $version \
--name 'prometheus' \
--license "Apache Software License 2.0" \
--maintainer "Fabian Reinartz <[email protected]>" \
$src_dir/prometheus=/usr/bin/prometheus \
$src_dir/promtool=/usr/bin/promtool
fpm -s dir -t rpm -p builds \
--rpm-os linux \
-a $( echo $arch | sed -e 's/amd64/x86_64/' ) \
-v $version \
--name 'prometheus' \
--license "Apache Software License 2.0" \
--maintainer "Fabian Reinartz <[email protected]>" \
$src_dir/prometheus=/usr/bin/prometheus \
$src_dir/promtool=/usr/bin/promtool
}
build $version $os $arch