summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Dunstone2018-03-26 17:14:12 +1100
committerGareth Dunstone2018-03-26 17:14:12 +1100
commit6240ea162ecbc5557c733abaac6d4cbf6b85c30a (patch)
treedcc22bdbf500a0f821c823acd3ac8869ec39e507
downloadaur-6240ea162ecbc5557c733abaac6d4cbf6b85c30a.tar.gz
initial commit. Mainly followed other peoples examples (like influxdb-bin)
-rw-r--r--.SRCINFO31
-rw-r--r--LICENSE22
-rw-r--r--PKGBUILD39
-rw-r--r--auto.ex92
-rw-r--r--kapacitor-bin.install6
-rw-r--r--kapacitor.install7
-rw-r--r--kapacitor.service.d12
-rw-r--r--kapacitor.sysusers1
-rw-r--r--kapacitor.tmpfiles4
9 files changed, 214 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..3062a563c757
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,31 @@
+pkgbase = kapacitor-bin
+ pkgdesc = An open source agent for collecting metrics and data on the system; Binary release
+ pkgver = 1.4.1
+ pkgrel = 1
+ url = https://github.com/influxdata/kapacitor
+ install = kapacitor.install
+ arch = i686
+ arch = x86_64
+ arch = armv6h
+ arch = armv7h
+ license = MIT
+ conflicts = kapacitor
+ conflicts = tickfmt
+ backup = etc/kapacitor/kapacitor.conf
+ source = kapacitor.sysusers
+ source = kapacitor.tmpfiles
+ source = LICENSE
+ sha256sums = 94aa16ca0b89b1773abb2333d03233921effccc9461ca1491eba42688a1505bd
+ sha256sums = ae8da72ee9e077e60f897b2e3920add44b0c4853a6c1bb6cf70767d6caeb4763
+ sha256sums = bece49bfc61abbb9d0b69bebb47955a44617ada83186c95db5651cd40c0a867a
+ source_i686 = kapacitor.tar.gz::https://dl.influxdata.com/kapacitor/releases/kapacitor-1.4.1_linux_i386.tar.gz
+ sha256sums_i686 = 29bf5e2c27988029065b93f900b498919f2ad90cc51bfdab67c033697cd7f524
+ source_x86_64 = kapacitor.tar.gz::https://dl.influxdata.com/kapacitor/releases/kapacitor-1.4.1_linux_amd64.tar.gz
+ sha256sums_x86_64 = 3fab8a4cdf58d180320f39eac090d90f99d6c4b76f993c7ec0c494f2a6a934c7
+ source_armv6h = kapacitor.tar.gz::https://dl.influxdata.com/kapacitor/releases/kapacitor-1.4.1_linux_armhf.tar.gz
+ sha256sums_armv6h = 3e3481267b54284017bc3e6bdfc89519cabdb971477a55fc6353c99caec5ba44
+ source_armv7h = kapacitor.tar.gz::https://dl.influxdata.com/kapacitor/releases/kapacitor-1.4.1_linux_armhf.tar.gz
+ sha256sums_armv7h = 3e3481267b54284017bc3e6bdfc89519cabdb971477a55fc6353c99caec5ba44
+
+pkgname = kapacitor-bin
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 000000000000..1393544bbad4
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 InfluxDB
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..9a6c9b59af16
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,39 @@
+# Maintainer: Gareth Dunstone <gareth.dunstone at anu dot edu dot au>
+
+pkgname=kapacitor-bin
+pkgver=1.4.1
+pkgrel=1
+pkgdesc="An open source agent for collecting metrics and data on the system; Binary release"
+arch=('i686' 'x86_64' 'armv6h' 'armv7h')
+url="https://github.com/influxdata/kapacitor"
+license=('MIT')
+depends=("")
+conflicts=('kapacitor' 'tickfmt')
+backup=('etc/kapacitor/kapacitor.conf')
+install=kapacitor.install
+
+source_i686=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_i386.tar.gz")
+sha256sums_i686=('29bf5e2c27988029065b93f900b498919f2ad90cc51bfdab67c033697cd7f524')
+source_x86_64=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_amd64.tar.gz")
+sha256sums_x86_64=('3fab8a4cdf58d180320f39eac090d90f99d6c4b76f993c7ec0c494f2a6a934c7')
+source_armv6h=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_armhf.tar.gz")
+sha256sums_armv6h=('3e3481267b54284017bc3e6bdfc89519cabdb971477a55fc6353c99caec5ba44')
+source_armv7h=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_armhf.tar.gz")
+sha256sums_armv7h=('3e3481267b54284017bc3e6bdfc89519cabdb971477a55fc6353c99caec5ba44')
+source=('kapacitor.sysusers' 'kapacitor.tmpfiles' 'LICENSE')
+sha256sums=('94aa16ca0b89b1773abb2333d03233921effccc9461ca1491eba42688a1505bd'
+'ae8da72ee9e077e60f897b2e3920add44b0c4853a6c1bb6cf70767d6caeb4763'
+'bece49bfc61abbb9d0b69bebb47955a44617ada83186c95db5651cd40c0a867a')
+
+package() {
+ cd $srcdir/kapacitor-$pkgver-$pkgrel
+ install -Dm644 ../kapacitor.sysusers "$pkgdir/usr/lib/sysusers.d/kapacitor.conf"
+ install -Dm644 ../kapacitor.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/kapacitor.conf"
+ install -Dm644 ../LICENSE "${pkgdir}/usr/share/licenses/kapacitor-bin/LICENSE"
+
+ install -Dm755 usr/bin/kapacitord "$pkgdir/usr/bin/kapacitord"
+ install -Dm755 usr/bin/kapacitor "$pkgdir/usr/bin/kapacitor"
+ install -Dm644 usr/lib/kapacitor/scripts/kapacitor.service "$pkgdir/usr/lib/systemd/system/kapacitor.service"
+ install -Dm644 etc/kapacitor/kapacitor.conf "$pkgdir/etc/kapacitor/kapacitor.conf"
+ install -Dm644 etc/logrotate.d/kapacitor "$pkgdir/etc/logrotate.d/kapacitor"
+}
diff --git a/auto.ex b/auto.ex
new file mode 100644
index 000000000000..c0a20cfec1fb
--- /dev/null
+++ b/auto.ex
@@ -0,0 +1,92 @@
+defmodule Auto do
+ use Tesla
+
+ @pkg "PKGBUILD"
+ @srcinfo ".SRCINFO"
+
+ @map %{
+ "Linux Binaries (32-bit)" => ["i686"],
+ "Linux Binaries (64-bit)" => ["x86_64"],
+ "Linux Binaries (ARM)" => ["armv6h", "armv7h"],
+ }
+
+ def get_html() do
+ res = get("https://portal.influxdata.com/downloads")
+ res.body
+ end
+
+ def parse(html) do
+ m = html
+ |> Floki.find("#kapacitor-modal h4")
+ |> Enum.filter(fn {"h4", _, items} ->
+ Enum.any?(@map, fn {key, value} ->
+ items
+ |> Floki.text()
+ |> String.contains?(key)
+ end)
+ end)
+ |> Enum.flat_map(fn {"h4", _, [arch | _] = items} ->
+ arches = Map.fetch!(@map, String.trim(arch))
+ checksum = items |> Floki.find("code") |> Floki.text()
+ arches |> Enum.map(fn ar -> {ar, checksum} end)
+ end)
+ |> Enum.into(Map.new())
+
+ version_string = html |> Floki.find("#kapacitor-modal .modal-title") |> Floki.text()
+ [_, version] = Regex.run(~r/.*v(.*)/, version_string)
+
+"""
+# Maintainer: Gareth Dunstone <gareth.dunstone@anu.edu.au>
+
+pkgname=kapacitor-bin
+pkgver=#{version}
+pkgrel=1
+pkgdesc="An open source agent for collecting metrics and data on the system; Binary release"
+arch=('i686' 'x86_64' 'armv6h' 'armv7h')
+url="https://github.com/influxdata/kapacitor"
+license=('MIT')
+depends=("")
+conflicts=('kapacitor')
+backup=('etc/kapacitor/kapacitor.conf')
+install=kapacitor.install
+
+source_i686=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_i386.tar.gz")
+sha256sums_i686=('#{m["i686"]}')
+source_x86_64=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_amd64.tar.gz")
+sha256sums_x86_64=('#{m["x86_64"]}')
+source_armv6h=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_armhf.tar.gz")
+sha256sums_armv6h=('#{m["armv6h"]}')
+source_armv7h=(kapacitor.tar.gz::"https://dl.influxdata.com/kapacitor/releases/kapacitor-${pkgver}_linux_armhf.tar.gz")
+sha256sums_armv7h=('#{m["armv7h"]}')
+source=('kapacitor.sysusers' 'kapacitor.tmpfiles' 'LICENSE')
+sha256sums=('94aa16ca0b89b1773abb2333d03233921effccc9461ca1491eba42688a1505bd' '94aa16ca0b89b1773abb2333d03233921effccc9461ca1491eba42688a1505bd' '94aa16ca0b89b1773abb2333d03233921effccc9461ca1491eba42688a1505bd')
+
+package() {
+ cd $srcdir/kapacitor-$pkgver-$pkgrel
+ install -Dm644 ../kapacitor.sysusers "$pkgdir/usr/lib/sysusers.d/kapacitor.conf"
+ install -Dm644 ../kapacitor.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/kapacitor.conf"
+ install -Dm644 ../LICENSE "${pkgdir}/usr/share/licenses/kapacitor-bin/LICENSE"
+
+ install -Dm755 usr/bin/kapacitord "$pkgdir/usr/bin/kapacitord"
+ install -Dm755 usr/bin/kapacitor "$pkgdir/usr/bin/kapacitor"
+ install -Dm644 usr/lib/kapacitor/scripts/kapacitor.service "$pkgdir/usr/lib/systemd/system/kapacitor.service"
+ install -Dm644 etc/kapacitor/kapacitor.conf "$pkgdir/etc/kapacitor/kapacitor.conf"
+ install -Dm644 etc/logrotate.d/kapacitor "$pkgdir/etc/logrotate.d/kapacitor"
+}
+"""
+ end
+
+ def process(content) do
+ IO.puts "Working directory #{System.cwd!()}"
+ File.write!(@pkg, content)
+
+ {output, _code} = System.cmd("makepkg", ["--printsrcinfo"])
+ File.write(@srcinfo, output)
+ end
+
+ def run() do
+ get_html()
+ |> parse()
+ |> process()
+ end
+end
diff --git a/kapacitor-bin.install b/kapacitor-bin.install
new file mode 100644
index 000000000000..c679e3206627
--- /dev/null
+++ b/kapacitor-bin.install
@@ -0,0 +1,6 @@
+post_install() {
+ groupadd -r kapacitor &>/dev/null
+ useradd -r -g kapacitor -d /var/lib/kapacitor -s /bin/false kapacitor &>/dev/null
+
+ install -dm700 -o kapacitor -g kapacitor /var/lib/kapacitor
+}
diff --git a/kapacitor.install b/kapacitor.install
new file mode 100644
index 000000000000..5e64efbe53e4
--- /dev/null
+++ b/kapacitor.install
@@ -0,0 +1,7 @@
+#/bin/sh
+
+post_install() {
+ systemd-sysusers /usr/lib/sysusers.d/kapacitor.conf
+ systemd-tmpfiles --create /usr/lib/tmpfiles.d/kapacitor.conf
+ install -d -m 755 -o kapacitor -g kapacitor /var/log/kapacitor
+}
diff --git a/kapacitor.service.d b/kapacitor.service.d
new file mode 100644
index 000000000000..dca0531fd6c6
--- /dev/null
+++ b/kapacitor.service.d
@@ -0,0 +1,12 @@
+#[Service]
+#ExecStart=
+#ExecStart=/usr/bin/kapacitor -config /etc/kapacitor/kapacitor.conf $KAPACITOR_OPTS
+
+[Service]
+User=kapacitor
+Group=kapacitor
+LimitNOFILE=65536
+EnvironmentFile=-/etc/default/kapacitor
+ExecStart=/usr/bin/kapacitord -config /etc/kapacitor/kapacitor.conf $KAPACITOR_OPTS
+KillMode=process
+Restart=on-failure
diff --git a/kapacitor.sysusers b/kapacitor.sysusers
new file mode 100644
index 000000000000..f49a5385cc2d
--- /dev/null
+++ b/kapacitor.sysusers
@@ -0,0 +1 @@
+u kapacitor - - /etc/kapacitor
diff --git a/kapacitor.tmpfiles b/kapacitor.tmpfiles
new file mode 100644
index 000000000000..38ff5774f100
--- /dev/null
+++ b/kapacitor.tmpfiles
@@ -0,0 +1,4 @@
+d /var/lib/kapacitor 0755 kapacitor kapacitor
+d /etc/kapacitor 0755 kapacitor kapacitor
+x /var/lib/kapacitor/*
+x /etc/kapacitor/*