elb-instance-status v1.0.0

This commit is contained in:
Knut Ahlers 2022-05-02 16:48:54 +02:00
commit 156194e88d
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
4 changed files with 102 additions and 0 deletions

16
.SRCINFO Normal file
View file

@ -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

38
PKGBUILD Normal file
View file

@ -0,0 +1,38 @@
# Maintainer: Knut Ahlers <knut at ahlers dot me>
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"
}

11
elb-instance-status.yml Normal file
View file

@ -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
...

37
update_version.sh Executable file
View file

@ -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}"