summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b03c788a84a09bd1cbc368944500242f9bbe03e5 (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
# Maintainer: Mantas Mikulėnas <grawity@gmail.com>
pkgname=open-plc-utils
pkgver=r524.gbb50f635
pkgrel=5
pkgdesc="Qualcomm Atheros Open Powerline Toolkit for HomePlug AV"
arch=(i686 x86_64)
url=https://github.com/qca/open-plc-utils
license=(custom:Clear_BSD)
makedepends=(git)
_commit=bb50f635ef6cec8b52898051e0d18f4ac3fdd331
source=("git+https://github.com/qca/open-plc-utils#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  echo r$(git rev-list --count HEAD).g$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname
  make
}

package() {
  cd $pkgname
  make \
    ROOTFS="$pkgdir" \
    BIN="$pkgdir"/usr/bin \
    MAN="$pkgdir"/usr/share/man/man1 \
    install \
    manuals

  install -D -m 644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

  # Install additional docs
  mkdir -p "$pkgdir"/usr/share/doc/$pkgname
  cp -av docbook "$pkgdir"/usr/share/doc/$pkgname/docbook

  # Avoid conflict with bluez-utils
  mv "$pkgdir"/usr/bin/amptest{,.plc}

  # Avoid conflict with aur/pev
  mv "$pkgdir"/usr/bin/pev{,.plc}

  # Restrict binaries that send or capture arbitrary frames
  for f in "$pkgdir"/usr/bin/e[df]??; do
    chmod -c u-s "$f"
  done

  # Make the remaining binaries look less scary in `ls`
  # (I'm still on the fence about making all of them :wheel-only)
  find "$pkgdir"/usr/bin -type f -perm /u+s \
    -exec chmod -c u-s {} \; \
    -exec setcap cap_net_raw=ep {} \;
}

# vim: ts=2:sw=2:et: