diff options
| author | Alejandro Soto <alejandro@34project.org> | 2026-03-09 02:33:10 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2026-03-09 02:33:10 -0600 |
| commit | 2de1a4811ea5f3363dc84432f0bc0bb339c43676 (patch) | |
| tree | cdf4db71c8d44cd9939f75ccd44702818d02f68e /trivionomicon/pkgs/athena-bccr/unwrapped.nix | |
| parent | b49ad4ea2e2797c065b83e95515a10f1dd82c0e5 (diff) | |
trivionomicon: athena-bccr: patch hard-coded FHS paths in idopte driver
Diffstat (limited to '')
| -rw-r--r-- | trivionomicon/pkgs/athena-bccr/unwrapped.nix | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/trivionomicon/pkgs/athena-bccr/unwrapped.nix b/trivionomicon/pkgs/athena-bccr/unwrapped.nix index c7781e4..3a70144 100644 --- a/trivionomicon/pkgs/athena-bccr/unwrapped.nix +++ b/trivionomicon/pkgs/athena-bccr/unwrapped.nix @@ -102,6 +102,7 @@ libnotify, openssl, pcsclite, + python3, stdenv, unzip, webkitgtk_4_1, @@ -124,6 +125,7 @@ nativeBuildInputs = [ autoPatchelfHook + python3 ]; outputs = ["out" "lib"]; @@ -132,15 +134,34 @@ runHook preInstall install -m755 -d $out/bin $lib/{etc,lib/SCMiddleware} - install -m755 usr/lib/SCMiddleware/{idocachesrv,SCManager} $out/bin - install -m755 usr/lib/SCMiddleware/*.so $lib/lib/SCMiddleware + install -m755 usr/lib/SCMiddleware/SCManager $out/bin + install -m755 usr/lib/SCMiddleware/{*.so,idocachesrv} $lib/lib/SCMiddleware cp -r etc/id* $lib/etc runHook postInstall ''; preFixup = '' - patchelf --set-rpath $lib/lib/SCMiddleware $lib/lib/SCMiddleware/* $out/bin/* + for elf in $lib/lib/SCMiddleware/* $out/bin/*; do + python3 /dev/fd/3 <$elf >$elf.patched 3<<EOF + import sys + contents = sys.stdin.buffer.read() + + def bin_replace(s, a, b): + assert len(a) >= len(b) + return s.replace(a, b + b'\0' * (len(a) - len(b))) + + contents = bin_replace(contents, b'/usr/lib/SCMiddleware', b'/etc/SCMiddleware') + contents = bin_replace(contents, b'/tmp/.idoss_socket', b'/run/idoss/socket') + + sys.stdout.buffer.write(contents) + EOF + + chmod --reference=$elf $elf.patched + mv $elf.patched $elf + + patchelf --set-rpath $lib/lib/SCMiddleware $elf + done ''; passthru.pkcs11-path = "lib/SCMiddleware/libidop11.so"; |
