summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e845be35170960fcb6b398e1acaf0664b36c46c9 (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
# Maintainer: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

pkgname=pdudaemon-git
pkgver=r261.8aa9950
pkgrel=2
pkgdesc='Daemon for controlling PDUs (Power Distribution Units)'
arch=(any)
url="https://github.com/pdudaemon/pdudaemon"
license=('GPL2')
depends=('python' 'python-aiohttp' 'python-requests' 'python-pexpect'
         'python-systemd' 'python-paramiko' 'python-pyserial'
         'python-hidapi' 'python-pysnmp' 'python-pyasn1'
         'python-pyusb' 'python-pymodbus')
makedepends=('python-setuptools' 'python-setuptools-scm' 'git'
             'python-build' 'python-installer' 'python-wheel')
conflicts=('pdudaemon')
provides=('pdudaemon')
backup=('etc/pdudaemon/pdudaemon.conf')
source=('pdudaemon::git+https://github.com/pdudaemon/pdudaemon.git'
        'sysusers.d'
        'tmpfiles.d')
sha256sums=('SKIP'
            '889b97b347ae9b3d27f507ed9c40212e8e7e741d0ba5a5a36d28c2a5935e59c1'
            'fc725d7ffe871d08e53c36ec1495e602dc0e5595f94f0ecec6c097987c78b411')

pkgver() {
  cd "${pkgname%-git}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${pkgname%-git}"
  python -m build --wheel --no-isolation
}

package() {
  cd "${pkgname%-git}"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -D -m755 "pduclient" "${pkgdir}/usr/bin/pduclient"
  install -D -m644 "share/pdudaemon.conf" "${pkgdir}/etc/pdudaemon/pdudaemon.conf"
  install -D -m644 "share/pdudaemon.service" "${pkgdir}/usr/lib/systemd/system/pdudaemon.service"
  install -D -m644 "${srcdir}/tmpfiles.d" "${pkgdir}/usr/lib/tmpfiles.d/pdudaemon.conf"
  install -D -m644 "${srcdir}/sysusers.d" "${pkgdir}/usr/lib/sysusers.d/pdudaemon.conf"

  sed "s/DynamicUser=yes/User=pdudaemon/" -i "${pkgdir}/usr/lib/systemd/system/pdudaemon.service"
}