0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

Merge pull request #219388 from charles-dyfis-net/safenet-update

pcsc-safenet: 10.0.37 -> 10.8.28
This commit is contained in:
Ryan Lahfa 2023-03-28 15:15:38 +02:00 committed by GitHub
commit 9bfc59d891
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,38 +1,45 @@
{ stdenv { stdenv
, lib , lib
, fetchurl , runCommand
, fetchzip
, autoPatchelfHook , autoPatchelfHook
, dpkg , dpkg
, gtk2 , gtk3
, openssl , openssl_1_1
, pcsclite , pcsclite
, unzip
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "pcsc-safenet"; pname = "pcsc-safenet";
version = "10.0.37-0"; version = "10.8.28";
# https://aur.archlinux.org/packages/sac-core/ debName = "Installation/Standard/Ubuntu-2004/safenetauthenticationclient_${version}_amd64.deb";
src = fetchurl {
url = "https://storage.spidlas.cz/public/soft/safenet/SafenetAuthenticationClient-core-${version}_amd64.deb"; # extract debian package from larger zip file
sha256 = "1r9739bhal7ramj1rpawaqvik45xbs1c756l1da96din638gzy5l"; src =
}; let
versionWithUnderscores = builtins.replaceStrings ["."] ["_"] version;
in fetchzip {
url = "https://www.digicert.com/StaticFiles/SAC_${versionWithUnderscores}_GA_Build.zip";
hash = "sha256-7XWj3T9/KnmgQ05urOJV6dqgkAS/A2G7efnqjQO2ing=";
};
dontBuild = true; dontBuild = true;
dontConfigure = true; dontConfigure = true;
unpackPhase = '' unpackPhase = ''
dpkg-deb -x $src . dpkg-deb -x "$src/$debName" .
''; '';
buildInputs = [ buildInputs = [
gtk2 gtk3
openssl openssl_1_1
pcsclite pcsclite
]; ];
runtimeDependencies = [ runtimeDependencies = [
openssl openssl_1_1
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
@ -41,35 +48,36 @@ stdenv.mkDerivation rec {
]; ];
installPhase = '' installPhase = ''
# Set up for pcsc drivers mv usr/* .
mkdir -p pcsc/drivers mkdir -p pcsc/drivers
mv usr/share/eToken/drivers/* pcsc/drivers/ mv -- lib/pkcs11/* pcsc/drivers/
rm -r usr/share/eToken/drivers rmdir lib/pkcs11
# Move binaries out mkdir "$out"
mv usr/bin bin cp -r ./* "$out/"
# Move UI to bin # for each library like libfoo.so.1.2.3, create symlinks to it from libfoo.so, libfoo.so.1, libfoo.so.1.2
mv usr/share/SAC/SACUIProcess bin/ (
rm -r usr/share/SAC cd "$out/lib/" || exit
for f in *.so.*.*.*; do # find library names with three-layer suffixes
ln -sf "$f" "''${f%.*}" || exit # strip only one suffix layer
ln -sf "$f" "''${f%.*.*}" || exit # strip two suffix layers
ln -sf "$f" "''${f%.*.*.*}" || exit # strip all three suffix layers
done
) || exit
mkdir $out # when library links are missing in pcsc/drivers, create them
cp -r {bin,etc,lib,pcsc,usr,var} $out/ (
cd "$out/pcsc/drivers" || exit
for f in *; do
if [[ ! -e $f && -e ../../lib/$f ]]; then
ln -sf ../../lib/"$f" "$f" || exit
fi
done
) || exit
cd "$out/lib/" ln -sf ${lib.getLib openssl_1_1}/lib/libcrypto.so $out/lib/libcrypto.so.1.1.0
ln -sf libeToken.so.10.0.37 libeTPkcs11.so
ln -sf libeToken.so.10.0.37 libeToken.so.10.0
ln -sf libeToken.so.10.0.37 libeToken.so.10
ln -sf libeToken.so.10.0.37 libeToken.so
ln -sf libcardosTokenEngine.so.10.0.37 libcardosTokenEngine.so.10.0
ln -sf libcardosTokenEngine.so.10.0.37 libcardosTokenEngine.so.10
ln -sf libcardosTokenEngine.so.10.0.37 libcardosTokenEngine.so
cd $out/pcsc/drivers/aks-ifdh.bundle/Contents/Linux/
ln -sf libAksIfdh.so.10.0 libAksIfdh.so
ln -sf libAksIfdh.so.10.0 libAksIfdh.so.10
ln -sf ${lib.getLib openssl}/lib/libcrypto.so $out/lib/libcrypto.so.1.0.0
''; '';
dontAutoPatchelf = true; dontAutoPatchelf = true;