From b01329feb8313d4b8ac41200ac437c2228ce1b3d Mon Sep 17 00:00:00 2001 From: Diego Elio Pettenò Date: Mon, 18 Dec 2006 23:13:16 +0000 Subject: Add a find() commodity function so that a particular find command can be used instead of the default one, this is needed for OpenBSD compatibility as their 'secure' version does not support the -exec {} + option. svn path=/trunk/; revision=21 --- lib/functions.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/functions.sh b/lib/functions.sh index f585c78..23e696e 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -41,6 +41,19 @@ gpatch() { return $? } +# Alias a working find(1), so that we can make sure the -exec {} + works. +# OpenBSD find(1) is stone age. +find() { + local findcmd="@findcmd@" + + # We assume that if no find is specified, then we're using a decent + # version of find(1). + [[ "${findcmd//@/|}" == "|findcmd|" ]] && findcmd="$(type -P find)" + + "${findcmd}" "$@" + return $? +} + # Simple wrapper around debianutils mktemp and BSD mktemp, # based on the emktemp function in eutils.eclass by # Mike Frysinger (vapier@gentoo.org) -- cgit v1.2.3-65-gdbad