diff options
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 7d25472993c59..8081b69bffd37 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -180,6 +180,17 @@ installBin() { } +# Return success if the specified file is an ELF object. +isELF() { + local fn="$1" + local magic + exec {fd}< "$fn" + read -n 4 -u $fd magic + exec {fd}<&- + if [[ "$magic" =~ ELF ]]; then return 0; else return 1; fi +} + + ###################################################################### # Initialisation. |