makedeb


sd-bin 0.7.6-1


Intuitive find & replace CLI (sed alternative)

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for sd-bin.

# vim: ft=sh syntax=sh softtabstop=2 tabstop=2 shiftwidth=2 fenc=utf-8 expandtab
# Maintainer: alfador <the.alfador@pm.me>

_github_repo="chmln/sd"
_pkgname="$(basename "${_github_repo}")"

pkgname="${_pkgname}-bin"
# shellcheck disable=SC2034
pkgver="0.7.6"
# shellcheck disable=SC2034
pkgrel=1
# shellcheck disable=SC2034
pkgdesc="Intuitive find & replace CLI (sed alternative)"
# 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
source=("${pkgname}-${pkgver}::${url}/releases/download/v${pkgver}/${_pkgname}-v${pkgver}-${CARCH}-unknown-linux-musl"
        "https://raw.githubusercontent.com/${_github_repo}/v${pkgver}/LICENSE"
        "https://raw.githubusercontent.com/${_github_repo}/v${pkgver}/README.md")
# shellcheck disable=SC2034
sha512sums=("87d8e91433c6a31ac40826d36b361c78c67e34b5c39c1dc7dac16fb572f69282bf7df398a7fd41f94b38530542740facde1ff23916ed84e9233a0cdb404d9f2c"
            # LICENSE
            "e11f691193ed373bdb21b5d698b0a0ecf91716b885896fe46e4849e38be55593367c378faac37518820b04793b301bc2f601efeb80d5ae5834d5a998f0aa80cd"
            # README.md
            "536050ba0a3f746d2ae22fbbabcb69d46c32ccf28e279048193bc8ff62d52faa36fdcf343a32a87d9578e69d27e222149b59b3a72d62a9d2520a950cec8aa374")
# shellcheck disable=SC2034
options=(!strip)
pkgver() {
  curl \
    -sL "https://api.github.com/repos/${_github_repo}/releases/latest" |
    jq -r '.tag_name' |
    sed -e 's/v//g'
}
prepare() {
  msg2 "ensuring '${srcdir}/${pkgname}-${pkgver}' is executable"
  chmod +x "${srcdir}/${pkgname}-${pkgver}"
}
check() {
  [ "$("${srcdir}/${pkgname}-${pkgver}" --version)" != "${_pkgname} ${pkgver}" ] && return 1 || return 0
}
package() {
  # ─── BINARY ─────────────────────────────────────────────────────────────────────
  install -Dm755 "${srcdir}/${pkgname}-${pkgver}" "${pkgdir}/usr/bin/${_pkgname}"
  # ─── README ─────────────────────────────────────────────────────────────────────
  install -Dm644 "${srcdir}/README.md" "${pkgdir}/usr/share/doc/${_pkgname}/README.md"
  # ─── LICENSES ───────────────────────────────────────────────────────────────────
  # [ NOTE ] => since there are two Licences,  decided to choose MIT for the 'copyright' file.
  install -Dm644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/doc/${_pkgname}/copyright"
}