detect executables in a crude way and tag them.

This commit is contained in:
espie 2008-06-06 15:03:30 +00:00
parent a51ab3810c
commit db2d9f0cab

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: make-plist,v 1.97 2008/05/21 10:07:14 espie Exp $
# $OpenBSD: make-plist,v 1.98 2008/06/06 15:03:30 espie Exp $
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
@ -534,6 +534,8 @@ sub get_type
return "library";
} elsif (is_plugin($filename)) {
return "plugin";
} elsif (is_binary($filename)) {
return "binary";
} else {
return "file";
}
@ -584,6 +586,20 @@ sub is_library
return is_shared_object($filename);
}
sub is_binary
{
my $filename = shift;
$filename = resolve_link($filename);
return 0 unless -x $filename;
my $check=`/usr/bin/file $filename`;
chomp $check;
if ($check =~m/\: ELF (32|64)-bit (MSB|LSB) executable\,/) {
return 1;
} else {
return 0;
}
}
sub is_plugin
{
my $filename = shift;
@ -897,6 +913,8 @@ sub create_object
return OpenBSD::PackingElement::InfoFile->new($short);
} elsif ($type eq "library") {
return OpenBSD::PackingElement::Lib->new($short);
} elsif ($type eq "binary") {
return OpenBSD::PackingElement::Binary->new($short);
} else {
if (defined $item) {
if ($item->isa("OpenBSD::PackingElement::Shell")) {