f916081e1c
set pipefail changes the pipeline return status from being the return status of the last command to the last non 0 exit status of any command in the pipeline. This is needed to make sure all the commands in a pipeline did actually return a non 0 status and not only the last one. PR: 250723 Exp-run by: antoine Reviewed by: bapt Approved by: bapt Differential Revision: https://reviews.freebsd.org/D27007
36 lines
981 B
Bash
36 lines
981 B
Bash
#!/bin/sh
|
|
# MAINTAINER: portmgr@FreeBSD.org
|
|
# $FreeBSD$
|
|
|
|
set -o pipefail
|
|
|
|
[ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_FIND_LIB}" ] && set -x
|
|
|
|
if [ -z "${LIB_DIRS}" -o -z "${LOCALBASE}" ]; then
|
|
echo "LIB_DIRS, LOCALBASE required in environment." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ -f /usr/share/misc/magic.mime -o -f /usr/share/misc/magic.mime.mgc ]; then
|
|
echo >&2
|
|
echo "Either /usr/share/misc/magic.mime or /usr/share/misc/magic.mime.mgc exist and must be removed." >&2
|
|
echo "These are legacy files from an older release and may safely be deleted." >&2
|
|
echo "Please see UPDATING 20150213 for more details." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "$0: no argument provided." >&2
|
|
fi
|
|
|
|
lib=$1
|
|
dirs="${LIB_DIRS} $(cat ${LOCALBASE}/libdata/ldconfig/* 2>/dev/null || :)"
|
|
|
|
for libdir in ${dirs} ; do
|
|
test -f ${libdir}/${lib} || continue
|
|
libfile=${libdir}/${lib}
|
|
[ "$(/usr/bin/file -b -L --mime-type ${libfile})" = "application/x-sharedlib" ] || continue
|
|
echo $libfile
|
|
break
|
|
done
|