[ap/hugo-bin] better hugo package than SBo (includes zsh completion)

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2022-05-19 14:12:17 +02:00
parent 4e864120ea
commit d28a631f9b
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

71
ap/hugo-bin/SlackBuild Executable file
View file

@ -0,0 +1,71 @@
#!/bin/bash
CWD=$(pwd)
PRGNAM=$(basename $CWD)
GITHUB_REPO=gohugoio/hugo
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/${GITHUB_REPO}/tags | jq -r '.[0].name' | tr -d v)}
ARCH=$(uname -m)
BUILD=${BUILD:-1}
TAG=${TAG:-gwh}
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/pkg-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
mkdir -p $REPOSITORY
HUGO_ARCH="64bit"
case $(uname -m) in
"x86_64")
HUGO_ARCH="64bit"
;;
"aarch64")
HUGO_ARCH="ARM64"
;;
"arm*")
HUGO_ARCH="ARM"
;;
esac
[ ! -e $REPOSITORY/hugo_${VERSION}_Linux-${HUGO_ARCH}.tar.gz ] && wget -c -O $REPOSITORY/hugo_${VERSION}_Linux-${HUGO_ARCH}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_Linux-${HUGO_ARCH}.tar.gz
rm -fr $PKG
mkdir -p $PKG/usr/{bin,doc/hugo}/
cd $PKG/usr/bin/
tar xvf $REPOSITORY/hugo_${VERSION}_Linux-${HUGO_ARCH}.tar.gz
mv README.md LICENSE $PKG/usr/doc/hugo/
chmod +x $PKG/usr/bin/hugo
mkdir -p $PKG/usr/share/zsh/site-functions
$PKG/usr/bin/hugo completion zsh > $PKG/usr/share/zsh/site-functions/_hugo
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} (The worlds fastest framework for building websites.)
${PRGNAM}:
${PRGNAM}: This software does not utilize Adobe Digital Editions nor Wine. It is
${PRGNAM}: completely free and open-source software written natively for Linux.
${PRGNAM}:
${PRGNAM}:
${PRGNAM}:
${PRGNAM}:
${PRGNAM}:
${PRGNAM}:
${PRGNAM}: https://gohugo.io
EOF
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg -l y -c n ${OUTPUT}/${PRGNAM}-$(echo ${VERSION} | tr - _)-${ARCH}-${BUILD}${TAG}.txz