From: AsamK Date: Sun, 14 Feb 2021 09:40:35 +0000 (+0100) Subject: Add more information for libsignal-client native dependency X-Git-Tag: v0.8.0~1 X-Git-Url: https://git.nmode.ca/signal-cli/commitdiff_plain/9eeba88bd05bfcf58632f1951dc52df58e58cc6d Add more information for libsignal-client native dependency --- diff --git a/README.md b/README.md index 1b797b7c..a3900649 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,12 @@ signal-cli is primarily intended to be used on servers to notify admins of impor ## Installation -You can [build signal-cli](#building) yourself, or use the [provided binary files](https://github.com/AsamK/signal-cli/releases/latest), which should work on Linux, macOS and Windows. For Arch Linux there is also a [package in AUR](https://aur.archlinux.org/packages/signal-cli/) and there is a [FreeBSD port](https://www.freshports.org/net-im/signal-cli) available as well. You need to have at least JRE 11 installed, to run signal-cli. +You can [build signal-cli](#building) yourself, or use the [provided binary files](https://github.com/AsamK/signal-cli/releases/latest), which should work on Linux, macOS and Windows. For Arch Linux there is also a [package in AUR](https://aur.archlinux.org/packages/signal-cli/) and there is a [FreeBSD port](https://www.freshports.org/net-im/signal-cli) available as well. + +System requirements: +- at least Java Runtime Environment (JRE) 11 +- native libraries: libzkgroup, libsignal-client + Those are bundled for x86_64 Linux, for other systems/architectures see: [Provide native lib for libsignal](https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal) ### Install system-wide on Linux See [latest version](https://github.com/AsamK/signal-cli/releases). diff --git a/lib/src/main/java/org/asamk/signal/manager/config/ServiceConfig.java b/lib/src/main/java/org/asamk/signal/manager/config/ServiceConfig.java index 7a54edd1..0b83f53e 100644 --- a/lib/src/main/java/org/asamk/signal/manager/config/ServiceConfig.java +++ b/lib/src/main/java/org/asamk/signal/manager/config/ServiceConfig.java @@ -49,6 +49,15 @@ public class ServiceConfig { } } + public static boolean isSignalClientAvailable() { + try { + org.signal.client.internal.Native.DisplayableFingerprint_Format(new byte[30], new byte[30]); + return true; + } catch (UnsatisfiedLinkError ignored) { + return false; + } + } + public static AccountAttributes.Capabilities getCapabilities() { return capabilities; } diff --git a/src/main/java/org/asamk/signal/App.java b/src/main/java/org/asamk/signal/App.java index e35285c3..90efc20f 100644 --- a/src/main/java/org/asamk/signal/App.java +++ b/src/main/java/org/asamk/signal/App.java @@ -121,6 +121,11 @@ public class App { + " because the required native library dependency is missing: libzkgroup"); } + if (!ServiceConfig.isSignalClientAvailable()) { + logger.error("Missing required native library dependency: libsignal-client"); + return 1; + } + if (command instanceof ProvisioningCommand) { if (username != null) { System.err.println("You cannot specify a username (phone number) when linking");