git.iko.soy/typeable/nixpkgs
on master help sign in
gnupg1compat: reintroduce symlinks, only when actually needed
commit1e237142964793c9c3d55faaa3a8cdbe3315c855 authorCharles Duffy <charles@dyfis.net> dateSat 6 Oct 2018, 13:26 (8 years ago) parentf7cd362
1 file changed+13−5
pkgs/tools/security/gnupg/1compat.nix+13−5
pkgs/tools/security/gnupg/1compat.nix+13−5
@@ -4,14 +4,22 @@ stdenv.mkDerivation {
44 name = "gnupg1compat-${gnupg.version}";
55
66 builder = writeScript "gnupg1compat-builder" ''
7+ PATH=${coreutils}/bin
78 # First symlink all top-level dirs
8− ${coreutils}/bin/mkdir -p $out
9− ${coreutils}/bin/ln -s "${gnupg}/"* $out
9+ mkdir -p $out
10+ ln -s "${gnupg}/"* $out
1011
1112 # Replace bin with directory and symlink it contents
12− ${coreutils}/bin/rm $out/bin
13− ${coreutils}/bin/mkdir -p $out/bin
14− ${coreutils}/bin/ln -s "${gnupg}/bin/"* $out/bin
13+ rm $out/bin
14+ mkdir -p $out/bin
15+ ln -s "${gnupg}/bin/"* $out/bin
16+
17+ # Add symlinks for any executables that end in 2 and lack any non-*2 version
18+ for f in $out/bin/*2; do
19+ [[ -x $f ]] || continue # ignore failed globs and non-executable files
20+ [[ -e ''${f%2} ]] && continue # ignore commands that already have non-*2 versions
21+ ln -s -- "''${f##*/}" "''${f%2}"
22+ done
1523 '';
1624
1725 meta = gnupg.meta // {