Skip to content

Commit

Permalink
update-sources: clean version modification in case of failure
Browse files Browse the repository at this point in the history
(cherry picked from commit fadb4b6)
  • Loading branch information
fepitre committed Mar 7, 2020
1 parent 21828df commit 0bcc904
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions update-sources
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ set -o pipefail

[ "$DEBUG" = "1" ] && set -x

exit_clean() {
local exit_code=$?
if [ $exit_code -gt 0 ]; then
git checkout -- version
fi
exit "${exit_code}"
}

distance_version() {
read -ra VER1 <<<"$(echo "$1" | tr '.' ' ')"
read -ra VER2 <<<"$(echo "$2" | tr '.' ' ')"
Expand Down Expand Up @@ -42,6 +50,8 @@ if [ "x$LATEST_KERNEL_VERSION" == "x" ]; then
fi

# Download latest kernel
trap 'exit_clean' 0 1 2 3 6 15

echo "$LATEST_KERNEL_VERSION" > version
make get-sources

Expand Down

0 comments on commit 0bcc904

Please sign in to comment.