diff options
-rw-r--r-- | eltpatch.in | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/eltpatch.in b/eltpatch.in index 8f6f9f3..d8c847b 100644 --- a/eltpatch.in +++ b/eltpatch.in @@ -3,10 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 # BSD support; https://bugs.gentoo.org/628882 -# note: this need to happen before function definitions -type -P gfind &>/dev/null && alias find=gfind -type -P gpatch &>/dev/null && alias patch=gpatch -type -P gsed &>/dev/null && alias sed=gsed +type -P gfind &>/dev/null && FIND=gfind || FIND=find +type -P gpatch &>/dev/null && PATCH=gpatch || PATCH=patch +type -P gsed &>/dev/null && SED=gsed || SED=sed source "@ELT_gentoofuncs@" || exit 1 @@ -40,11 +39,11 @@ ELT_try_and_apply_patch() { # Save file for permission restoration. `patch` sometimes resets things. # Ideally we'd want 'stat -c %a', but stat is highly non portable and we are # guaranted to have GNU find, so use that instead. - local perms="$(find ${file} -maxdepth 0 -printf '%m')" + local perms="$(${FIND} ${file} -maxdepth 0 -printf '%m')" # We only support patchlevel of 0 - why worry if its static patches? - if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then + if ${PATCH} -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then einfo " Applying ${disp} ..." - patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1 + ${PATCH} -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1 ret=$? ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}" else @@ -92,9 +91,9 @@ ELT_walk_patches() { pushd "@ELT_patchdir@" >/dev/null || die "pushd to elt-patch dir failed" # Go through the patches in reverse order (newer version to older) - for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do + for patch in $(${FIND} "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do tmp="${TMPDIR}/libtool-elt.patch" - sed "${sed_args[@]}" "${patch}" > "${tmp}" || die "sed on patch ${patch} failed" + ${SED} "${sed_args[@]}" "${patch}" > "${tmp}" || die "sed on patch ${patch} failed" if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then # Break to unwind w/popd rather than return directly ret=0 @@ -192,7 +191,7 @@ elibtoolize() { [[ -f ${S}/ltmain.sh || -f ${S}/configure ]] && dirs+=( "${S}" ) else [[ ${#dirs[@]} -eq 0 ]] && dirs+=( "${S}" ) - dirs=( $(find "${dirs[@]}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u) ) + dirs=( $(${FIND} "${dirs[@]}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u) ) fi local d p ret |