From dcf25c272f229566f1cc9a28e09acdf170971dd9 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 19 Apr 2023 12:06:02 -0400
Subject: signal-cli: initial inclusion

---
 linhes/signal-cli/PKGBUILD      | 64 +++++++++++++++++++++++++++++++++++++++++
 linhes/signal-cli/signal-cli.sh |  6 ++++
 2 files changed, 70 insertions(+)
 create mode 100644 linhes/signal-cli/PKGBUILD
 create mode 100644 linhes/signal-cli/signal-cli.sh

diff --git a/linhes/signal-cli/PKGBUILD b/linhes/signal-cli/PKGBUILD
new file mode 100644
index 0000000..7d6f2cd
--- /dev/null
+++ b/linhes/signal-cli/PKGBUILD
@@ -0,0 +1,64 @@
+# Maintainer: asamk <asamk@gmx.de>
+
+pkgname=signal-cli
+pkgver=0.11.8
+pkgrel=1
+pkgdesc="Provides a commandline and dbus interface for secure Signal messaging."
+arch=('any')
+url="https://github.com/AsamK/signal-cli"
+license=('GPL3')
+depends=('java-runtime-headless>=17' 'java-commons-logging' 'sh' 'libsignal-client')
+makedepends=('java-environment>=17' 'gradle' 'asciidoc')
+source=("https://github.com/AsamK/${pkgname}/archive/v${pkgver}.tar.gz"
+        "https://github.com/AsamK/${pkgname}/releases/download/v${pkgver}/v${pkgver}.tar.gz.asc"
+        "${pkgname}.sh")
+sha512sums=('1b7cde358ce8f02c57a9a55b59a84492c1533c435a5d173579839d19f8a0416da97bf600ec05b5b5c2c65f8c2a43308c5be0906fd4483285074b86e01f5d09a0'
+            'SKIP'
+            'f58d7851c53eae1874692f032a489cb6fb459763a4195afaf93ddd4c65939e1e4e2bbf50438e04800aded466266c3a2a37fcc0f5168f61b8e711fcf03e8e8d12')
+validpgpkeys=('FA10826A74907F9EC6BBB7FC2BA2CD21B5B09570')
+
+build() {
+	cd "${srcdir}"
+	cd "${pkgname}-${pkgver}"
+
+	GRADLE_USER_HOME="${srcdir}/.gradle" gradle --no-daemon installDist
+
+	cd man
+	make
+}
+
+package() {
+	install -m755 -d "${pkgdir}/usr/share/java/${pkgname}" \
+	                 "${pkgdir}/usr/bin" \
+	                 "${pkgdir}/usr/lib/systemd/system/" \
+	                 "${pkgdir}/usr/lib/sysusers.d/" \
+	                 "${pkgdir}/usr/lib/tmpfiles.d/" \
+	                 "${pkgdir}/usr/share/man/man1/" \
+	                 "${pkgdir}/usr/share/man/man5/" \
+	                 "${pkgdir}/etc/dbus-1/system.d/"
+
+	cd "${srcdir}"
+
+	install -m755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
+
+	cd "${pkgname}-${pkgver}"
+
+	install -m644 "data/${pkgname}.sysusers.conf" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+	install -m644 "data/${pkgname}.tmpfiles.conf" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
+	install -m644 "data/org.asamk.Signal.conf" "${pkgdir}/etc/dbus-1/system.d/"
+	install -m644 "data/${pkgname}@.service" "${pkgdir}/usr/lib/systemd/system/"
+	install -m644 "data/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/"
+	install -m644 "data/${pkgname}-socket.service" "${pkgdir}/usr/lib/systemd/system/"
+	install -m644 "data/${pkgname}-socket.socket" "${pkgdir}/usr/lib/systemd/system/"
+	sed -i "s|%dir%|/usr|" "${pkgdir}/usr/lib/systemd/system/${pkgname}@.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}-socket.service"
+
+	install -m644 "man/${pkgname}.1" "${pkgdir}/usr/share/man/man1/"
+	install -m644 "man/${pkgname}-dbus.5" "${pkgdir}/usr/share/man/man5/"
+	install -m644 "man/${pkgname}-jsonrpc.5" "${pkgdir}/usr/share/man/man5/"
+
+	cd "build/install/${pkgname}"
+
+	rm -f lib/commons-logging-*.jar
+	rm -f lib/libsignal-client-*.jar
+	install -m644 lib/*.jar "${pkgdir}/usr/share/java/${pkgname}/"
+}
diff --git a/linhes/signal-cli/signal-cli.sh b/linhes/signal-cli/signal-cli.sh
new file mode 100644
index 0000000..21077ea
--- /dev/null
+++ b/linhes/signal-cli/signal-cli.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+CP="/usr/share/java/libsignal-client/libsignal-client.jar":"/usr/share/java/commons-logging/commons-logging.jar"
+for name in /usr/share/java/signal-cli/*.jar ; do
+	CP=$CP:"$name"
+done
+exec /usr/bin/java -cp "$CP" org.asamk.signal.Main "$@"
-- 
cgit v0.12

