From 156194e88d3f20c5c835c4c5bbe54f239c3e3f93 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 2 May 2022 16:48:54 +0200 Subject: [PATCH] elb-instance-status v1.0.0 --- .SRCINFO | 16 ++++++++++++++++ PKGBUILD | 38 ++++++++++++++++++++++++++++++++++++++ elb-instance-status.yml | 11 +++++++++++ update_version.sh | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 .SRCINFO create mode 100644 PKGBUILD create mode 100644 elb-instance-status.yml create mode 100755 update_version.sh diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..869b924 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,16 @@ +pkgbase = elb-instance-status + pkgdesc = Small monitoring daemon for AWS Autoscaling Group Healthchecks + pkgver = 1.0.0 + pkgrel = 1 + url = https://github.com/Luzifer/elb-instance-status + arch = i686 + arch = x86_64 + license = Apache + makedepends = go + backup = etc/elb-instance-status.yml + source = elb-instance-status-1.0.0.tar.gz::https://github.com/Luzifer/elb-instance-status/archive/v1.0.0.tar.gz + source = elb-instance-status.yml + sha512sums = 92ec4ca9dd41375ac93a7f163b3a52af139d71fc711dffd1d073678c563da0a7336b93820c34f2844ed23d0cb76168b5a6ea8817a2ed8932c43902f397f05d46 + sha512sums = bbd6a0d6f0ba8bcb9bf05b200b231b1b4ab7f37a069414b7075634298931825c843a8b4ab136a360be3009554915d5748939d60ddc7585ea0223c26a1402e97a + +pkgname = elb-instance-status diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..06aee20 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,38 @@ +# Maintainer: Knut Ahlers + +pkgname=elb-instance-status +pkgver=1.0.0 +pkgrel=1 +pkgdesc="Small monitoring daemon for AWS Autoscaling Group Healthchecks" + +arch=('i686' 'x86_64') +backup=("etc/${pkgname}.yml") +url="https://github.com/Luzifer/$pkgname" +license=('Apache') +depends=() +makedepends=('go') +source=( + "${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz" + "elb-instance-status.yml" +) +sha512sums=( + '92ec4ca9dd41375ac93a7f163b3a52af139d71fc711dffd1d073678c563da0a7336b93820c34f2844ed23d0cb76168b5a6ea8817a2ed8932c43902f397f05d46' + 'bbd6a0d6f0ba8bcb9bf05b200b231b1b4ab7f37a069414b7075634298931825c843a8b4ab136a360be3009554915d5748939d60ddc7585ea0223c26a1402e97a' +) + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + go build \ + -trimpath \ + -buildmode=pie \ + -ldflags="-X main.version=${pkgver}" \ + -mod=readonly \ + -modcacherw \ + -o ${pkgname} +} + +package() { + install -Dm644 -t "${pkgdir}/etc" "${srcdir}/${pkgname}-${pkgver}/${pkgname}.yml" + install -Dm755 -t "${pkgdir}/usr/bin" "${srcdir}/${pkgname}-${pkgver}/${pkgname}" + install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" "${srcdir}/${pkgname}-${pkgver}/LICENSE" +} diff --git a/elb-instance-status.yml b/elb-instance-status.yml new file mode 100644 index 0000000..ea14c4e --- /dev/null +++ b/elb-instance-status.yml @@ -0,0 +1,11 @@ +--- + +root_free_inodes: + name: Ensure there are at least 30% free inodes on / + command: test $(df -i | grep "/$" | xargs | cut -d ' ' -f 5 | sed "s/%//") -lt 70 + +root_free_diskspace: + name: Ensure there is at least 30% free disk space on / + command: test $(df | grep "/$" | xargs | cut -d ' ' -f 5 | sed "s/%//") -lt 70 + +... diff --git a/update_version.sh b/update_version.sh new file mode 100755 index 0000000..f3f5d48 --- /dev/null +++ b/update_version.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -euxo pipefail + +# Read pkg name +PKG=$(awk -F '=' '/pkgname=/{ print $2 }' PKGBUILD) + +# Get latest version +VER=$(git ls-remote --tags --sort -v:refname https://github.com/Luzifer/elb-instance-status.git | + head -n1 | + grep -Eo 'tags/v[0-9.]+' | + grep -Eo '[0-9.]+$') + +# Insert latest version into PKGBUILD +sed -i \ + -e "s/^pkgver=.*/pkgver=${VER}/" \ + PKGBUILD + +# Check whether this changed anything +if (git diff --exit-code PKGBUILD); then + echo "Package ${PKG} has most recent version ${VER}" + exit 0 +fi + +# Reset pkgrel +sed -i \ + -e 's/pkgrel=.*/pkgrel=1/' \ + PKGBUILD + +# Update source hashes +updpkgsums + +# Update .SRCINFO +makepkg --printsrcinfo >.SRCINFO + +# Commit changes +git add PKGBUILD .SRCINFO +git commit -m "${PKG} v${VER}"