summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 06053b90ab244e7086d09473734afb5938707ccf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Maintainer: Phillip Schichtel <phillip@schich.tel>

pkgname=nomad-pack-git
pkgver=v0.0.1.techpreview2.r194.gbff08ce
pkgrel=1
pkgdesc="A templating and packaging tool used with HashiCorp Nomad."
arch=('x86_64' 'armv7h' 'aarch64')
url="https://github.com/hashicorp/nomad-pack"
license=('MPL-2.0')
depends=(openssl git)
replaces=(nomad-pack-nightly)
makedepends=(git go)
optdepends=(bash-completion)
provides=(nomad-pack)
conflicts=(nomad-pack)
source=("git+https://github.com/hashicorp/nomad-pack.git#branch=main"
        "bash-completion.sh")
sha256sums=('SKIP'
            'ac6a0c1f54833f4706ec7366c570b3088a06ca21128642f21435a7f464b98129')

pkgver() {
  cd "$srcdir/nomad-pack"
  git describe --long --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  local version="$(pkgver)"
  cd "$srcdir/nomad-pack"
  export CGO_ENABLED=0
  go build -ldflags "-X '$(go list -m)/internal/pkg/version.GitDescribe=${version}'" -trimpath
}

package() {
  install -D -m755 "$srcdir/nomad-pack/nomad-pack" "$pkgdir/usr/bin/nomad-pack"
  local bash_completions_dir="$pkgdir/usr/share/bash-completion/completions"
  install -D -d -m755 "$bash_completions_dir" 
  install -m644 "$srcdir/bash-completion.sh" "$bash_completions_dir/nomad-pack" 
}