path: root/support
diff options
authorGravatar Yann E. MORIN <yann.morin.1998@free.fr>2016-07-05 19:36:03 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-07-06 14:47:30 +0200
commitd5ae67b4f4b4256a392997f81c9668c6809aab3b (patch)
treecac46c8555f0fa87d9f20daa2320160a99b368d9 /support
parent7e23692ece811ac11abeeb59337c14d5f79427de (diff)
support/apply-patches: re-instate set -e
As reported by S├ębastien Szymanski [1], the apply-patches script doesn't stop if a tar command can't extract an archive. Use "set -e" to exit immediately if a command return an error. Be sure to ignore any expected error: when we check if a patch to be applied has the same basename as an already applied patch, the grep would fail when no such patch was already applied. We should not fail in this case. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: S├ębastien Szymanski <sebastien.szymanski@armadeus.com> Cc: Romain Naour <romain.naour@openwide.fr> Reviewed-by: Romain Naour <romain.naour@gmail.com> Tested-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
1 files changed, 3 insertions, 1 deletions
diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
index 694302d33e..7ccb39dd8f 100755
--- a/support/scripts/apply-patches.sh
+++ b/support/scripts/apply-patches.sh
@@ -31,6 +31,8 @@
# applied. The list of the patches applied is stored in '.applied_patches_list'
# file in the build directory.
+set -e
if [ "$1" = "-s" ] ; then
# add option to be used by the patch tool
@@ -103,7 +105,7 @@ function apply_patch {
echo "Error: missing patch file ${path}/$patch"
exit 1
- existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list)"
+ existing="$(grep -E "/${patch}\$" ${builddir}/.applied_patches_list || true)"
if [ -n "${existing}" ]; then
echo "Error: duplicate filename '${patch}'"
echo "Conflicting files are:"