Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/documentserver_community.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-01-22 17:21:39 +0300
committerRobin Appelman <robin@icewind.nl>2020-01-22 17:21:51 +0300
commit7a71acf9c223736f06a566feec2dae26b90df6f8 (patch)
tree6747bd858c3101ee84719954ddc8ede68a28edd4 /lib
parent31eb8c807df4abff76a901ca4ed98bfd63669d4b (diff)
add detection and proper error message for musl based systems
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/StaticController.php4
-rw-r--r--lib/SetupCheck.php23
2 files changed, 23 insertions, 4 deletions
diff --git a/lib/Controller/StaticController.php b/lib/Controller/StaticController.php
index 40f9b78..6fcf792 100644
--- a/lib/Controller/StaticController.php
+++ b/lib/Controller/StaticController.php
@@ -86,9 +86,7 @@ class StaticController extends Controller {
// we use this as an opportunity to do some checks and present error messages
// by serving a custom js file instead
if ($path === 'apps/api/documents/api.js') {
- if (!file_exists($localPath)) {
- $localPath = __DIR__ . '/../../js/notbuild.js';
- } else if (!$this->setupCheck->check()) {
+ if (!$this->setupCheck->check()) {
$hint = $this->setupCheck->getHint();
$localPath = __DIR__ . '/../../js/binaryerror.js';
$rawContent = file_get_contents($localPath);
diff --git a/lib/SetupCheck.php b/lib/SetupCheck.php
index 5eb6983..1e36b85 100644
--- a/lib/SetupCheck.php
+++ b/lib/SetupCheck.php
@@ -21,7 +21,6 @@
namespace OCA\DocumentServer;
-
use OCA\DocumentServer\Document\ConverterBinary;
class SetupCheck {
@@ -49,7 +48,29 @@ class SetupCheck {
if (!is_executable(ConverterBinary::BINARY_DIRECTORY . '/x2t')) {
return "can't execute x2t binary, ensure php can execute binaries in the app folder";
}
+ $ldError = $this->lddError();
+ if (strpos($ldError, 'ld-linux') !== false) {
+ return "using a musl libc based distribution is not supported";
+ } else if ($ldError) {
+ return "one or more dependencies are missing";
+ }
return '';
}
+
+ private function lddError(): string {
+ $descriptorSpec = [
+ 0 => ["pipe", "r"],// stdin
+ 1 => ["pipe", "w"],// stdout
+ 2 => ["pipe", "w"] // stderr
+ ];
+
+ $pipes = [];
+ proc_open('ldd x2t', $descriptorSpec, $pipes, ConverterBinary::BINARY_DIRECTORY, []);
+
+ fclose($pipes[0]);
+ $error = stream_get_contents($pipes[2]);
+
+ return trim($error);
+ }
}