ports/sysutils/bsdadminscripts/files/patch-src::pkg_libchk
Eygene Ryabinkin 03ceb9d488 Allow pkg_libchk to work from non-CSH shells
/bin/sh does not set OSTYPE, so this variable is inherited from the
shell from which pkg_libchk is invoked.  From all standard shells in
the base system, only csh and tcsh do set this variable, so when
pkg_libchk is invoked from sh (that is not invoked from csh-like
shell), this variable will be empty.  Moreover, bash sets OSTYPE to
freebsdX.Y, so grepping on output of 'readelf -e' wont work either.

'uname -s' provides much more reliable way to get the name of the
operating system and all *BSD ELF ABI types inside readelf correspond
to the 'uname -s':
{{{
    case ELFOSABI_NETBSD:       return "UNIX - NetBSD";
    case ELFOSABI_FREEBSD:      return "UNIX - FreeBSD";
    case ELFOSABI_OPENBSD:      return "UNIX - OpenBSD";
}}}

PR: ports/158967
Approved-by: Dominic Fandrey <kamikaze@bsdforen.de> (maintainer), erwin (mentor)
Feature-safe: yes
2011-07-18 10:06:50 +00:00

20 lines
542 B
Plaintext

--- pkg_libchk.orig 2011-07-16 21:42:34.990085774 +0400
+++ pkg_libchk 2011-07-16 21:45:53.405082081 +0400
@@ -23,6 +23,7 @@
readonly name=pkg_libchk
readonly version=1.6.1
+readonly osname=`uname -s`
# Use a line break as delimiter.
IFS='
@@ -206,7 +207,7 @@
# We cannot handle non-native binaries,
# so assume everything is in order.
if ! readelf -e "$1" 2>&1 | \
- grep -E "^[[:space:]]*OS/ABI:[[:space:]]*UNIX - $OSTYPE\$" \
+ grep -E "^[[:space:]]*OS/ABI:[[:space:]]*UNIX - $osname\$" \
> /dev/null
then
return 2