git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #71460 from danieldk/softmaker-office-fix-unlock

softmaker-office: fix product unlock error

commitc0dd1e540035ebe88391ea59b0f6d410000c79fe authorJosé Romildo Malaquias <malaquias@gmail.com> dateMon 21 Oct 2019, 20:33 (7 years ago) parent57cf3306f6331d
1 file changed+26−4
pkgs/applications/office/softmaker/generic.nix+26−4
pkgs/applications/office/softmaker/generic.nix+26−4
@@ -3,6 +3,10 @@
33 # Dynamic Libraries
44, curl, libGL, libX11, libXext, libXmu, libXrandr, libXrender
55
6+ # For fixing up execution of /bin/ls, which is necessary for
7+ # product unlocking.
8+, coreutils, libredirect
9+
610, pname, version, edition, suiteName, src, archive
711
812, ...
@@ -45,7 +49,22 @@ in stdenv.mkDerivation rec {
4549 runHook postUnpack
4650 '';
4751
48− installPhase = ''
52+ installPhase = let
53+ # SoftMaker/FreeOffice collects some system information upon
54+ # unlocking the product. But in doing so, it attempts to execute
55+ # /bin/ls. If the execve syscall fails, the whole unlock
56+ # procedure fails. This works around that by rewriting /bin/ls
57+ # to the proper path.
58+ #
59+ # SoftMaker Office restarts itself upon some operations, such
60+ # changing the theme and unlocking. Unfortunately, we do not
61+ # have control over its environment then and it will fail
62+ # with an error.
63+ lsIntercept = ''
64+ --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
65+ --set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls"
66+ '';
67+ in ''
4968 runHook preInstall
5069
5170 mkdir -p $out/share
@@ -54,9 +73,12 @@ in stdenv.mkDerivation rec {
5473 # Wrap rather than symlinking, so that the programs can determine
5574 # their resource path.
5675 mkdir -p $out/bin
57− makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker
58− makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations
59− makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker
76+ makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \
77+ ${lsIntercept}
78+ makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \
79+ ${lsIntercept}
80+ makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \
81+ ${lsIntercept}
6082
6183 for size in 16 32 48 64 96 128 256 512 1024; do
6284 mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps