summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0d98e865c1f6fd9e316340e72d59b7acbd80c491 (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
40
41
42
43
# Maintainer: graysky <graysky AT archlinux DOT us>
# Contributor: Stéphane Graber <stgraber AT ubuntu DOT com>

pkgname=distrobuilder
pkgver=228.70f3864
pkgrel=1
pkgdesc="System container image builder for LXC and LXD"
arch=('x86_64')
url="https://github.com/lxc/distrobuilder"
license=('APACHE')
depends=('lxc')
makedepends=('gcc-go' 'git')
source=(git://github.com/lxc/distrobuilder.git)
md5sums=('SKIP')

pkgver() {
  cd "$pkgname"
  echo "$(git rev-list --count HEAD).$(git describe --always)"
}

prepare() {
  [[ -d .gopath ]] || mkdir .gopath 
  export GOPATH="${srcdir}/.gopath"
  export PATH="${GOPATH}/bin:${PATH}"
}

build() {
  cd "$pkgname"
  go get -v -x github.com/lxc/distrobuilder/distrobuilder
}

package() {
  cd "$pkgname"
  _examples="$GOPATH/src/github.com/lxc/$pkgname/doc/examples"

  install -Dm755 "$GOPATH/bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
  install -d "$pkgdir/usr/share/$pkgname"
  install -d "$pkgdir/var/cache/$pkgname"

  for i in alpine archlinux centos debian fedora ubuntu; do
    install -m644 "$_examples/$i" "$pkgdir/usr/share/$pkgname/$i"
  done
}