--- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -668,6 +668,24 @@ if test "$backend" = "patch"; then fi } +# 'epatch' backend - used on Gentoo +elif test "$backend" = "epatch"; then + + patch_apply () + { + echo "cwd:$(pwd) patch:$1"; + if grep -q "^GIT binary patch" "$1"; then + if ! ../debian/tools/gitapply.sh -d "$DESTDIR" < "$1"; then + abort "Failed to apply patch, aborting!" + fi + else + local patch="$(readlink -f "$1")" + if ! (cd "$DESTDIR" && epatch "$patch"); then + abort "Failed to apply patch, aborting!" + fi + fi + } + # GIT backend - apply patches using 'git am' elif test "$backend" = "git" -o "$backend" = "git-am"; then @@ -833,8 +833,12 @@ fi # To make sure we find all the patches and tools switch to the patches directory now script="$(readlink -f "$0")" curdir="$(dirname "$script")" -if ! cd "$curdir"; then - abort "Failed to change working directory to $curdir." +if test -f "$curdir/patchinstall.sh"; then + if ! cd "$curdir"; then + abort "Failed to change working directory to $curdir." + fi +elif test ! -f ./patchinstall.sh; then + abort "Failed to find patch directory." fi # If autoupdate is enabled then create a tempfile to keep track of all patches