summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2006-12-18 23:13:16 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2006-12-18 23:13:16 +0000
commitb01329feb8313d4b8ac41200ac437c2228ce1b3d (patch)
tree811396be906711d33edc844b87ef53a2c0258689 /lib/functions.sh
parentRemove temporary files if the patch gets applied fine. (diff)
downloadautoepatch-b01329feb8313d4b8ac41200ac437c2228ce1b3d.tar.gz
autoepatch-b01329feb8313d4b8ac41200ac437c2228ce1b3d.tar.bz2
autoepatch-b01329feb8313d4b8ac41200ac437c2228ce1b3d.zip
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
Diffstat (limited to 'lib/functions.sh')
-rw-r--r--lib/functions.sh13
1 files changed, 13 insertions, 0 deletions
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)