From fb31b1a87668a75f8df68d737d4657e2e29449fa Mon Sep 17 00:00:00 2001 From: Sangbum Kim Date: Thu, 31 Mar 2016 22:50:55 +0900 Subject: [PATCH] added consul export sources --- .SRCINFO | 15 ++++++++++++++ 01-golang1_6.patch | 12 +++++++++++ PKGBUILD | 45 +++++++++++++++++++++++++++++++++++++++++ consul-exporter.install | 11 ++++++++++ consul-exporter.service | 32 +++++++++++++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100644 .SRCINFO create mode 100644 01-golang1_6.patch create mode 100644 PKGBUILD create mode 100644 consul-exporter.install create mode 100644 consul-exporter.service diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..6f732be --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = duff + pkgdesc = A command-line utility for quickly finding duplicates in a given set of files + pkgver = 0.5.2 + pkgrel = 1 + url = http://duff.sourceforge.net/ + arch = i686 + arch = x86_64 + license = custom + depends = glibc + depends = sh + source = http://downloads.sourceforge.net/sourceforge/duff/duff-0.5.2.tar.gz + md5sums = 483f9216ebea14b090e0d71dbf7077ff + +pkgname = duff + diff --git a/01-golang1_6.patch b/01-golang1_6.patch new file mode 100644 index 0000000..d374c92 --- /dev/null +++ b/01-golang1_6.patch @@ -0,0 +1,12 @@ +--- a/Makefile.COMMON 2016-03-31 21:27:13.088391632 +0900 +--- b/Makefile.COMMON 2016-03-31 21:27:13.088391632 +0900 ++++ Makefile.COMMON 2016-03-31 21:40:00.450234289 +0900 +@@ -44,7 +44,7 @@ + GOOS ?= $(shell uname | tr A-Z a-z) + GOARCH ?= $(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) + +-GO_VERSION ?= 1.5.1 ++GO_VERSION ?= 1.6 + GOURL ?= https://golang.org/dl + GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH).tar.gz + GOPATH := $(CURDIR)/.build/gopath diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..71c4968 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,45 @@ +# Maintainer: Stefan Husmann +# Contributor: Aaron Schaefer + +pkgname=consul-exporter +pkgver=0.2.0.r18.g673081d +pkgrel=1 +pkgdesc="Export Consul service health to Prometheus." +arch=('i686' 'x86_64') +url="https://github.com/prometheus/consul_exporter" +license=('custom') +depends=('glibc' 'sh' 'go') +source=( +"$pkgname::git+https://github.com/prometheus/consul_exporter.git" +"01-golang1_6.patch" +"consul-exporter.service" +"consul-exporter.install") +install=consul-exporter.install +sha512sums=('SKIP' + '44c3236cc5925c89dce5af1e8620fceee8f2f0c3bcaccb3530865d25b9a67d9d2898d07f9782a6da9344e867a5f537285e8697aacfa05c19f96e705f167aeb4a') + + + +pkgver() { + cd "$srcdir/$pkgname" + git describe --long --tags | sed -r 's/^go//;s/([^-]*-g)/r\1/;s/-/./g' +} +prepare(){ + cd "$srcdir/$pkgname" + patch -p1 -i "$srcdir/01-golang1_6.patch" + mkdir -p "${srcdir}/gopath" + export GOPATH="${srcdir}/gopath" +} + +build() { + cd ${srcdir}/${pkgname} + make +} + +package() { + cd ${srcdir}/${pkgname} + install -D -m755 consul_exporter ${pkgdir}/usr/bin/${pkgname} + mkdir -p "${pkgdir}/usr/lib/systemd/system/" + + install -pm 644 "${srcdir}/consul-exporter.service" "${pkgdir}/usr/lib/systemd/system/consul-exporter.service" +} diff --git a/consul-exporter.install b/consul-exporter.install new file mode 100644 index 0000000..6643f59 --- /dev/null +++ b/consul-exporter.install @@ -0,0 +1,11 @@ +post_install() { + systemctl daemon-reload +} + +post_upgrade() { + post_install +} + +post_remove() { + systemctl daemon-reload +} diff --git a/consul-exporter.service b/consul-exporter.service new file mode 100644 index 0000000..7a663a9 --- /dev/null +++ b/consul-exporter.service @@ -0,0 +1,32 @@ +# Copyright 2014 Joukou Ltd +# +# 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. +[Unit] +Description=consul-exporter +Documentation=https://github.com/prometheus/consul_exporter +After=network.target +After=network-online.target +After=machines.target + +[Service] +User=nobody +Group=nobody +Type=simple + +Restart=on-failure +RestartSec=10s + +ExecStart=/usr/bin/consul-exporter + +[Install] +WantedBy=multi-user.target