summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPlague Doctor2018-07-07 08:47:45 +1000
committerPlague Doctor2018-07-07 08:47:45 +1000
commit627cda66fc4eb5c3c17adb6789f23a7d78e955ac (patch)
tree33263abe815c5fbbdd992d4fcc3000d1b84e11ea
downloadaur-627cda66fc4eb5c3c17adb6789f23a7d78e955ac.tar.gz
TREZOR Bridge (written in Go) - first commit.
-rw-r--r--.SRCINFO18
-rw-r--r--.gitignore3
-rw-r--r--PKGBUILD41
-rw-r--r--trezord-go.install28
4 files changed, 90 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..6c8fa8d6386c
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,18 @@
+pkgbase = trezord-go
+ pkgdesc = TREZOR Communication Daemon aka TREZOR Bridge (written in Go)
+ pkgver = 2.0.18
+ pkgrel = 1
+ url = https://github.com/trezor/trezord-go
+ install = trezord-go.install
+ arch = x86_64
+ arch = i686
+ license = MIT
+ makedepends = go
+ conflicts = trezord-git
+ conflicts = trezor-bridge-bin
+ conflicts = trezord
+ options = !strip
+ options = !emptydirs
+
+pkgname = trezord-go
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..cc85376b511e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.tar.xz
+pkg
+src
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..b35c494a982d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Plague-doctor <plague <at>> privacyrequired <<dot>> com >
+
+pkgname=trezord-go
+pkgver=2.0.18
+pkgrel=1
+pkgdesc="TREZOR Communication Daemon aka TREZOR Bridge (written in Go)"
+arch=('x86_64' 'i686')
+url="https://github.com/trezor/trezord-go"
+license=('MIT')
+makedepends=('go')
+conflicts=('trezord-git' 'trezor-bridge-bin' 'trezord')
+options=('!strip' '!emptydirs')
+_gourl=github.com/trezor/trezord-go
+
+install="${pkgname}.install"
+
+build() {
+ export GOPATH="$srcdir"
+ go get -d -fix -v -x ${_gourl}
+ cd $srcdir/src/github.com/trezor/trezord-go
+ git checkout v$pkgver
+ go build ./trezord.go
+}
+
+check() {
+ GOPATH="$GOPATH:$srcdir" go test -v -x ${_gourl}
+}
+
+package() {
+ mkdir -p "$pkgdir/usr/bin"
+ install -p -m755 "$srcdir/src/github.com/trezor/trezord-go/trezord" "$pkgdir/usr/bin/trezord"
+
+ mkdir -p "$pkgdir/usr/lib/systemd/system"
+ install -p -m644 "$srcdir/src/github.com/trezor/trezord-go/release/linux/trezord.service" \
+ "$pkgdir/usr/lib/systemd/system/trezord.service"
+
+ mkdir -p "$pkgdir/etc/udev/rules.d"
+ install -p -m644 "$srcdir/src/github.com/trezor/trezord-go/release/linux/trezor.rules" \
+ "$pkgdir/etc/udev/rules.d"
+}
+
diff --git a/trezord-go.install b/trezord-go.install
new file mode 100644
index 000000000000..37baa7364f4f
--- /dev/null
+++ b/trezord-go.install
@@ -0,0 +1,28 @@
+pre_install(){
+ getent group trezord >/dev/null || groupadd -r trezord
+ getent group plugdev >/dev/null || groupadd -r plugdev
+ getent group trezord >/dev/null && useradd -r -g trezord -M -s /sbin/nologin -c "TREZOR Bridge" trezord
+ getent passwd trezord >/dev/null && usermod -a -G plugdev trezord
+}
+
+post_install() {
+ systemctl enable trezord.service
+ systemctl start trezord.service
+}
+
+pre_upgrade() {
+ systemctl stop trezord.service
+}
+
+post_upgrade() {
+ systemctl start trezord.service
+}
+
+pre_remove() {
+ systemctl stop trezord.service
+}
+
+post_remove() {
+ getent passwd trezord >/dev/null && userdel trezord
+ getent group trezord >/dev/null && groupdel trezord
+}