trivionomicon: athena-bccr: patch hard-coded FHS paths in idopte driver
This commit is contained in:
parent
913b3acec3
commit
dd366aa20e
2 changed files with 31 additions and 6 deletions
|
|
@ -7,6 +7,9 @@
|
||||||
}: let
|
}: let
|
||||||
athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
|
athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
|
||||||
inherit (athena) vendor;
|
inherit (athena) vendor;
|
||||||
|
|
||||||
|
driver = athena.card-driver.lib;
|
||||||
|
scmiddleware = "${driver}/lib/SCMiddleware";
|
||||||
in {
|
in {
|
||||||
environment = {
|
environment = {
|
||||||
etc =
|
etc =
|
||||||
|
|
@ -16,11 +19,12 @@ in {
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (vendor == "athena") {
|
// lib.optionalAttrs (vendor == "athena") {
|
||||||
"Athena".source = "${athena.card-driver.lib}/etc/Athena";
|
"Athena".source = "${driver}/etc/Athena";
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (vendor == "idopte") {
|
// lib.optionalAttrs (vendor == "idopte") {
|
||||||
"idoss.conf".source = "${athena.card-driver.lib}/etc/idoss.conf";
|
"idoss.conf".source = "${driver}/etc/idoss.conf";
|
||||||
"idoss.lic".source = "${athena.card-driver.lib}/etc/idoss.lic";
|
"idoss.lic".source = "${driver}/etc/idoss.lic";
|
||||||
|
"SCMiddleware".source = scmiddleware;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemPackages = [athena.card-driver];
|
systemPackages = [athena.card-driver];
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@
|
||||||
libnotify,
|
libnotify,
|
||||||
openssl,
|
openssl,
|
||||||
pcsclite,
|
pcsclite,
|
||||||
|
python3,
|
||||||
stdenv,
|
stdenv,
|
||||||
unzip,
|
unzip,
|
||||||
webkitgtk_4_1,
|
webkitgtk_4_1,
|
||||||
|
|
@ -124,6 +125,7 @@
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
autoPatchelfHook
|
autoPatchelfHook
|
||||||
|
python3
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs = ["out" "lib"];
|
outputs = ["out" "lib"];
|
||||||
|
|
@ -132,15 +134,34 @@
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
install -m755 -d $out/bin $lib/{etc,lib/SCMiddleware}
|
install -m755 -d $out/bin $lib/{etc,lib/SCMiddleware}
|
||||||
install -m755 usr/lib/SCMiddleware/{idocachesrv,SCManager} $out/bin
|
install -m755 usr/lib/SCMiddleware/SCManager $out/bin
|
||||||
install -m755 usr/lib/SCMiddleware/*.so $lib/lib/SCMiddleware
|
install -m755 usr/lib/SCMiddleware/{*.so,idocachesrv} $lib/lib/SCMiddleware
|
||||||
cp -r etc/id* $lib/etc
|
cp -r etc/id* $lib/etc
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
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";
|
passthru.pkcs11-path = "lib/SCMiddleware/libidop11.so";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue