fix: handle quarantine flag during portable startup on macOS (#3266)

pull/3268/head
patryk4815 4 months ago committed by GitHub
parent 77b161bd69
commit 6c5bb22948
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -55,12 +55,28 @@ let
export PATH="$dir/bin/:$PATH"
'';
macosQuarantine = lib.optionalString pkgs.stdenv.isDarwin ''
libpython="libpython${python3.pythonVersion}.dylib"
if command -v xattr >/dev/null 2>&1 && command -v grep >/dev/null 2>&1; then
if xattr -x "$dir/lib/$libpython" 2>/dev/null | grep -q com.apple.quarantine; then
echo "Error: The pwndbg is marked as quarantined by macOS."
echo "To fix this, run the following command:"
echo ""
echo " xattr -rd com.apple.quarantine \"$dir\""
echo ""
exit 1
fi
fi
'';
wrapperBinPy =
file:
pkgs.writeScript "pwndbg-wrapper-bin-py" ''
#!/bin/sh
dir="$(cd -- "$(dirname "$(dirname "$(realpath "$0")")")" >/dev/null 2>&1 ; pwd -P)"
${commonEnvs}
${macosQuarantine}
exec ${ldLoader} "$dir/exe/python3" "$dir/${file}" "$@"
'';
wrapperBin =
@ -69,6 +85,7 @@ let
#!/bin/sh
dir="$(cd -- "$(dirname "$(dirname "$(realpath "$0")")")" >/dev/null 2>&1 ; pwd -P)"
${commonEnvs}
${macosQuarantine}
exec ${ldLoader} "$dir/${file}" "$@"
'';

Loading…
Cancel
Save