Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
lib/builtins.sh: test file existence before patching
Browse files Browse the repository at this point in the history
Skip non-existent patches in ab_*_ patches.
  • Loading branch information
Plectranthus-fg committed Dec 8, 2021
1 parent 72eea4f commit f31dcd8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/builtins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ RPATCHFLAGS="-Rp1 -t"

ab_apply_patches() {
for i in "$@"; do
abinfo "Applying patch $i ..."
patch $PATCHFLAGS -i "$i" || abdie "Applying patch $i failed"
if [[ -e $i ]];then
abinfo "Applying patch $i ..."
patch $PATCHFLAGS -i "$i" || abdie "Applying patch $i failed"
fi
done
}

ab_reverse_patches() {
for i in "$@"; do
abinfo "Reverting patch $i ..."
patch $RPATCHFLAGS -i "$i" || abdie "Reverting patch $i failed"
if [[ -e $i ]];then
abinfo "Reverting patch $i ..."
patch $RPATCHFLAGS -i "$i" || abdie "Reverting patch $i failed"
fi
done
}

Expand All @@ -30,4 +34,4 @@ ab_match_arch() {
abinfo "Architecture '$ABHOST' mismatches '$1': taking false branch."
return 1
fi
}
}

0 comments on commit f31dcd8

Please sign in to comment.