summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 858e23e17e7bb54256506a25959ad67758a3f213 (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
# Maintainer: Ritiek Malhotra <ritiekmalhotra123+aur at gmail dotty com>

pkgname=pi400kb-git
pkgver=0.0.1.r4.g0a8cd14
pkgrel=1
pkgdesc='Raw HID keyboard forwarder to turn the Pi 400 into a USB keyboard'
arch=('aarch64')
url='https://github.com/Gadgetoid/pi400kb'
license=('MIT')
makedepends=('git' 'libconfig' 'gcc' 'make' 'cmake')
provides=('pi400kb')
conflicts=('pi400kb')
source=(git+"${url}")
sha256sums=('SKIP')

_gitname="pi400kb"


prepare() {
  cd "${_gitname}"
  git submodule update --init
  mkdir -p build
}

pkgver() {
  cd "${_gitname}"
  git describe --long --tags | sed 's:^v::;s:\([^-]*-g\):r\1:;s:-:.:g'
}

build() {
  cd "${_gitname}/build"
  cmake -DHOOK_PATH="/usr/bin/rpi400kb_hook.sh" ..
  make
}

check() {
  cd "${_gitname}/build"
  test -f "${_gitname}"
}

package() {
  cd ${_gitname}
  install -Dm755 "build/${_gitname}" "${pkgdir}/usr/bin/${_gitname}"
  install -Dm755 "hook.sh" "${pkgdir}/usr/bin/rpi400kb_hook.sh"
  install -Dm644 "${_gitname}.service" "${pkgdir}/usr/lib/systemd/system/${_gitname}.service"
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  mkdir -p "${pkgdir}/etc/modules-load.d/"
  echo libcomposite > "${pkgdir}/etc/modules-load.d/libcomposite.conf"

  echo
  echo ----------------------------------------------------------
  echo Execute the following to start the service now:
  echo   $ sudo modprobe libcomposite
  echo   $ sudo systemctl start pi400kb.service
  echo
  echo - Ctrl + Raspberry - Enable/disable forwarding
  echo - Ctrl + Shift + Raspberry - Exit
  echo
  echo Execute the following to start the service at every boot:
  echo   $ sudo systemctl enable pi400kb.service
  echo ----------------------------------------------------------
  echo
}