[PATCH 04/20] patch: always backup files

Elliott Mitchell ehem+openwrt at m5p.com
Tue Nov 14 17:04:46 PST 2023


Date: Thu, 26 Oct 2023 18:44:33 -0700

Avoiding modification of the original files allows their reuse.
This is a first step towards being able to reuse unpacked kernel
(or other) source.

Signed-off-by: Elliott Mitchell <ehem+openwrt at m5p.com>
---
 include/autotools.mk    | 2 +-
 scripts/patch-kernel.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/autotools.mk b/include/autotools.mk
index d0e4b3642f..53e8a0d6e6 100644
--- a/include/autotools.mk
+++ b/include/autotools.mk
@@ -61,7 +61,7 @@ define patch_libtool
 			lt_version="$$$$($$(STAGING_DIR_HOST)/bin/sed -ne 's,^[[:space:]]*VERSION="\?\([0-9]\.[0-9]\+\).*,\1,p' $$$$lt)"; \
 			case "$$$$lt_version" in \
 				1.5|2.2|2.4) echo "autotools.mk: Found libtool v$$$$lt_version - applying patch to $$$$lt"; \
-					(cd $$$$(dirname $$$$lt) && $$(PATCH) -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
+					(cd $$$$(dirname $$$$lt) && $$(PATCH) -b -N -s -p1 < $$(TOPDIR)/tools/libtool/files/libtool-v$$$$lt_version.patch || true) ;; \
 				*) echo "autotools.mk: error: Unsupported libtool version v$$$$lt_version - cannot patch $$$$lt"; exit 1 ;; \
 			esac; \
 		done; \
diff --git a/scripts/patch-kernel.sh b/scripts/patch-kernel.sh
index c2b7e72049..d3f1042343 100755
--- a/scripts/patch-kernel.sh
+++ b/scripts/patch-kernel.sh
@@ -37,7 +37,7 @@ for i in ${patchdir}/${patchpattern} ; do
     [ -d "${i}" ] && echo "Ignoring subdirectory ${i}" && continue	
     echo ""
     echo "Applying ${i} using ${type}: " 
-    ${uncomp} ${i} | ${PATCH:-patch} -f -p1 -d ${targetdir}
+    ${uncomp} ${i} | ${PATCH:-patch} -b -f -p1 -d ${targetdir}
     if [ $? != 0 ] ; then
         echo "Patch failed!  Please fix $i!"
 	exit 1
-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |       ehem+openwrt at m5p.com     PGP 87145445       |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445






More information about the openwrt-devel mailing list