summary refs log tree commit diff
path: root/pkgs/applications/office
diff options
context:
space:
mode:
authorDaniël de Kok <me@danieldk.eu>2019-10-20 19:36:35 +0200
committerDaniël de Kok <me@danieldk.eu>2019-10-20 19:36:35 +0200
commit6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f (patch)
tree035ec0d7d536475d89b8d22271658b67d991e02b /pkgs/applications/office
parentb16f6953a26fdb09269d8bdd6818000b8dd8ee7e (diff)
downloadnixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.tar
nixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.tar.gz
nixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.tar.bz2
nixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.tar.lz
nixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.tar.xz
nixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.tar.zst
nixpkgs-6f6331dbb38ae8fffbaeba3897cfd8ef09dc4d9f.zip
softmaker-office: fix product unlock error
SoftMaker/FreeOffice collects some system information upon unlocking the
product. But in doing so, it attempts to execute /bin/ls. If the execve
syscall fails, the whole unlock procedure fails. This works around that
by rewriting /bin/ls to the proper path.

SoftMaker Office restarts itself upon some operations, such changing the
theme and unlocking. Unfortunately, we do not have control over its
environment then and it will fail with an error. Starting SoftMaker
Office from scratch will then work.

Fixes #71228
Diffstat (limited to 'pkgs/applications/office')
-rw-r--r--pkgs/applications/office/softmaker/generic.nix30
1 files changed, 26 insertions, 4 deletions
diff --git a/pkgs/applications/office/softmaker/generic.nix b/pkgs/applications/office/softmaker/generic.nix
index 9505271db14..56dc6a5e4f7 100644
--- a/pkgs/applications/office/softmaker/generic.nix
+++ b/pkgs/applications/office/softmaker/generic.nix
@@ -3,6 +3,10 @@
   # Dynamic Libraries
 , curl, libGL, libX11, libXext, libXmu, libXrandr, libXrender
 
+  # For fixing up execution of /bin/ls, which is necessary for
+  # product unlocking.
+, coreutils, libredirect
+
 , pname, version, edition, suiteName, src, archive
 
 , ...
@@ -45,7 +49,22 @@ in stdenv.mkDerivation rec {
     runHook postUnpack
   '';
 
-  installPhase = ''
+  installPhase = let
+    # SoftMaker/FreeOffice collects some system information upon
+    # unlocking the product. But in doing so, it attempts to execute
+    # /bin/ls. If the execve syscall fails, the whole unlock
+    # procedure fails. This works around that by rewriting /bin/ls
+    # to the proper path.
+    #
+    # SoftMaker Office restarts itself upon some operations, such
+    # changing the theme and unlocking. Unfortunately, we do not
+    # have control over its environment then and it will fail
+    # with an error.
+    lsIntercept = ''
+      --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
+      --set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls"
+    '';
+  in ''
     runHook preInstall
 
     mkdir -p $out/share
@@ -54,9 +73,12 @@ in stdenv.mkDerivation rec {
     # Wrap rather than symlinking, so that the programs can determine
     # their resource path.
     mkdir -p $out/bin
-    makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker
-    makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations
-    makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker
+    makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \
+      ${lsIntercept}
+    makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \
+      ${lsIntercept}
+    makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \
+      ${lsIntercept}
 
     for size in 16 32 48 64 96 128 256 512 1024; do
       mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps