summaryrefslogtreecommitdiff
path: root/libre/parabola-hackers/PKGBUILD
blob: 1e1be9ce4e84159d9fdad2ab112b60dfb4ed269d (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>

pkgbase=parabola-hackers
pkgname=(parabola-hackers parabola-hackers-nshd)
pkgver=20180426
_gitver=a2b650881c7d263c60614debf83ea81aab92be27
pkgdesc='Programs for doing magic with hackers.git'
url='https://git.parabola.nu/packages/parabola-hackers.git/'
license=('GPL')

pkgrel=2
arch=('armv7h' 'i686' 'x86_64')
makedepends=('go' 'git')
source=("parabola-hackers::git://git.parabola.nu/packages/parabola-hackers.git#commit=${_gitver}"
        LICENSE.lgpl-2.1.txt::https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
        LICENSE.gpl-2.txt::https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
        LICENSE.apache-2.0.txt::https://www.apache.org/licenses/LICENSE-2.0
        LICENSE.wtfpl-2.txt::http://www.wtfpl.net/txt/copying/)
_gomodules=("git.lukeshu.com/go/libgnulinux#branch=master"
            "git.lukeshu.com/go/libnslcd#branch=master"
            "git.lukeshu.com/go/libsystemd#commit=0a43955"
            "github.com/pkg/errors#tag=v0.8.0"
            "go.googlesource.com/sys#commit=bb9c189"
            "gopkg.in/check.v1#commit=20d25e2"
            "gopkg.in/yaml.v2#commit=5420a8b")
for _gomodule in "${_gomodules[@]}"; do
  source+=("gopkg-$(sed -e 's/#.*//' -e 's/\//_/g' <<<"$_gomodule")::git+https://$_gomodule")
done
sha256sums=('SKIP'
            'dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551'
            '8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643'
            'cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30'
            '0356258391e190dc1d44ea01565cfe627fe44e27dad693a0a54c2483a7b223e5'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd "$srcdir/$pkgbase"
  grep VERSION < config.mk | awk '{print $3}'
}

prepare() {
  mv -Tv gopkg-go.googlesource.com_sys "$srcdir/$pkgbase"/go/src/golang.org/x/sys
  for gopkg in gopkg-*; do
    mv -Tv "$gopkg" "$srcdir/$pkgbase"/go/src/"$(sed 's/_/\//g' <<<"${gopkg#gopkg-}")"
  done

  cd "$srcdir/$pkgbase"

  printf '%s\n' \
      prefix='/usr' \
      bindir='$(libexecdir)/$(PACKAGE)' \
      libexecdir='$(libdir)' \
      sysconfdir='/etc' \
      >> config.mk

  mv -v "$srcdir"/LICENSE* .

  git submodule update --init
}

build() {
  cd "$srcdir/$pkgbase"
  make
}

check() {
  # On armv7h the tests fails with:
  #  |  FAIL	gopkg.in/yaml.v2 [build failed]
  if [ "$CARCH" != "armv7h" ]; then
    cd "$srcdir/$pkgbase"
    make check
  fi
}

package_parabola-hackers() {
  backup=(etc/$pkgbase.yml)
  depends=('ruby' 'colordiff')

  cd "$srcdir/$pkgbase"
  make DESTDIR="${pkgdir}" install
  find "$pkgdir" -type f \( -name 'nshd*' -o -name shadow \) -delete
  find "$pkgdir" -type d -empty -exec rmdir -p --ignore-fail-on-non-empty -- {} +
}

package_parabola-hackers-nshd() {
  pkgdesc='NSS and PAM integration for parabola-hackers'
  license=('GPL3')
  depends=("parabola-hackers=$pkgver" 'nss-pam-ldapd')
  backup=(etc/nshd/shadow)
  install=parabola-hackers-nshd.install
  replaces=(nshd)
  conflicts=(nshd)

  cd "$srcdir/$pkgbase"
  make DESTDIR="${pkgdir}" install
  find "$pkgdir" -type f -not \( -name 'nshd*' -o -name shadow \) -delete
  find "$pkgdir" -type d -empty -exec rmdir -p --ignore-fail-on-non-empty -- {} +

  install -d "${pkgdir}/usr/share/licenses/${pkgname}"
  cp -t "${pkgdir}/usr/share/licenses/${pkgname}" -- LICENSE.txt LICENSE.bsd*.txt
}