makedeb
A minimal, fast alternative to 'du -sh'
Viewing /PKGBUILD
.
Click here to go back to the Git tree for diskus-bin.
# vim: ft=sh syntax=sh softtabstop=2 tabstop=2 shiftwidth=2 fenc=utf-8 expandtab
# Maintainer: alfador <the.alfador@pm.me>
_github_repo="sharkdp/diskus"
_pkgname="$(basename "${_github_repo}")"
pkgname="${_pkgname}-bin"
# shellcheck disable=SC2034
pkgver=0.7.0
# shellcheck disable=SC2034
pkgrel=1
# shellcheck disable=SC2034
pkgdesc="A minimal, fast alternative to 'du -sh'"
# shellcheck disable=SC2034
arch=("x86_64")
# shellcheck disable=SC2034
provides=("${_pkgname}" "${_pkgname}-bin")
# shellcheck disable=SC2034
conflicts=("${_pkgname}" "${_pkgname}-git" "${_pkgname}-bin")
# shellcheck disable=SC2034
url="https://github.com/${_github_repo}"
# shellcheck disable=SC2034
license=("MIT")
# shellcheck disable=SC2034
makedepends=("curl" "jq")
# shellcheck disable=SC2034
optdepends=("bash-completion: for supporting auto completion")
# shellcheck disable=SC2034
source=("${pkgname}-${pkgver}.tar.gz::${url}/releases/download/v${pkgver}/${_pkgname}-v${pkgver}-${CARCH}-unknown-linux-musl.tar.gz")
# shellcheck disable=SC2034
sha512sums=("d32b3809fa90d06ba45f4bd4e0ec366f50f16a6e16d3eb57479d3fc03807ec084e9b725de6c4ff1c653f191515c1a32c8012120fa9e414a60f8db47bdbe0ed1f")
# shellcheck disable=SC2034
options=(!strip zipman)
pkgver() {
curl \
-sL "https://api.github.com/repos/${_github_repo}/releases/latest" |
jq -r '.tag_name' |
sed -e 's/v//g'
}
# [ NOTE ] => reaming extracted archive directory
# for naming consistency
prepare() {
_dirname="$(tar -tf "${pkgname}-${pkgver}.tar.gz" | head -n 1 | cut -d/ -f1)"
if [ " ${srcdir}/${pkgname}-${pkgver} " != " ${_dirname} " ]; then
mv -f "${srcdir}/${_dirname}" "${srcdir}/${pkgname}-${pkgver}"
fi
}
check() {
[ "$("${srcdir}/${pkgname}-${pkgver}/${_pkgname}" --version)" != "${_pkgname} ${pkgver}" ] && return 1 || return 0
}
package() {
# ─── BINARY ─────────────────────────────────────────────────────────────────────
install -Dm755 "${srcdir}/${pkgname}-${pkgver}/${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
# ─── README AND MAN PAGES ───────────────────────────────────────────────────────
install -Dm644 "${srcdir}/${pkgname}-${pkgver}/README.md" "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
install -Dm644 "${srcdir}/${pkgname}-${pkgver}/${_pkgname}.1" "${pkgdir}/usr/share/man/man1/${_pkgname}.1.gz"
# ─── LICENSES ───────────────────────────────────────────────────────────────────
# [ NOTE ] => since there are two Licences, decided to choose MIT for the 'copyright' file.
install -Dm644 "${srcdir}/${pkgname}-${pkgver}/LICENSE-MIT" "${pkgdir}/usr/share/doc/${_pkgname}/copyright"
install -Dm644 "${srcdir}/${pkgname}-${pkgver}/LICENSE-MIT" "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE-MIT"
install -Dm644 "${srcdir}/${pkgname}-${pkgver}/LICENSE-APACHE" "${pkgdir}/usr/share/doc/${_pkgname}/LICENSE-APACHE"
}