gnupg1compat: reintroduce symlinks, only when actually needed

This commit is contained in:
Charles Duffy 2018-10-06 13:26:35 -05:00
parent f7cd362ae4
commit 1e23714296
No known key found for this signature in database
GPG Key ID: 551385576326AAC1

View File

@ -4,14 +4,22 @@ stdenv.mkDerivation {
name = "gnupg1compat-${gnupg.version}"; name = "gnupg1compat-${gnupg.version}";
builder = writeScript "gnupg1compat-builder" '' builder = writeScript "gnupg1compat-builder" ''
PATH=${coreutils}/bin
# First symlink all top-level dirs # First symlink all top-level dirs
${coreutils}/bin/mkdir -p $out mkdir -p $out
${coreutils}/bin/ln -s "${gnupg}/"* $out ln -s "${gnupg}/"* $out
# Replace bin with directory and symlink it contents # Replace bin with directory and symlink it contents
${coreutils}/bin/rm $out/bin rm $out/bin
${coreutils}/bin/mkdir -p $out/bin mkdir -p $out/bin
${coreutils}/bin/ln -s "${gnupg}/bin/"* $out/bin ln -s "${gnupg}/bin/"* $out/bin
# Add symlinks for any executables that end in 2 and lack any non-*2 version
for f in $out/bin/*2; do
[[ -x $f ]] || continue # ignore failed globs and non-executable files
[[ -e ''${f%2} ]] && continue # ignore commands that already have non-*2 versions
ln -s -- "''${f##*/}" "''${f%2}"
done
''; '';
meta = gnupg.meta // { meta = gnupg.meta // {