slackbuilds/ap/logcli/SlackBuild

60 lines
1.8 KiB
Text
Raw Normal View History

2021-06-15 10:26:26 +02:00
#!/bin/bash
2021-04-12 15:50:50 +02:00
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/grafana/loki/releases/latest | grep tag_name | grep -o "[0-9.]*")}
ARCH=${ARCH:-$(uname -m)}
BUILD=${BUILD:-1}
TAG=${TAG:-gwh}
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/pkg-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
PREFIX=/usr
GITEA_WORK_DIR=/var/lib/gitea
wget -c https://github.com/grafana/loki/releases/download/v${VERSION}/logcli-linux-amd64.zip -O $CWD/logcli-linux-amd64-${VERSION}.zip
unzip $CWD/logcli-linux-amd64-${VERSION}.zip
rm -fr $PKG
mkdir -p $PKG$PREFIX/bin
mv $CWD/logcli-linux-amd64 $PKG$PREFIX/bin/${PRGNAM}
chmod +x $PKG$PREFIX/bin/${PRGNAM}
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
# HOW TO EDIT
THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler--------------------------------------------------------|
$PRGNAM: $PRGNAM (like Prometheus, but for logs)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/grafana/loki
$PRGNAM:
EOF
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz