From 53b46ce6d5596d3565815bd4381c9f18acd6d72c Mon Sep 17 00:00:00 2001 From: Julien Cretin <cretin@google.com> Date: Mon, 10 Feb 2020 10:39:28 +0100 Subject: [PATCH] Add instructions to re-run setup.sh --- setup.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 091fc33..ae0fd0c 100755 --- a/setup.sh +++ b/setup.sh @@ -31,13 +31,31 @@ git submodule update --init done_text="$(tput bold)DONE.$(tput sgr0)" +patch_conflict_detected () { + cat <<EOF + +This script cannot be run twice without reverting the patches. + +To do so, follow these instructions: +1. Commit any changes you want to save. +2. Run the ./reset.sh script to revert all uncommitted changes. +3. Run the ./setup.sh script again. +EOF + exit 1 +} + # Apply patches to kernel. Do that in a sub-shell ( cd third_party/tock/ && \ for p in ../../patches/tock/[0-9][0-9]-*.patch do echo -n '[-] Applying patch "'$(basename $p)'"... ' - git apply "$p" && echo $done_text + if git apply "$p" + then + echo $done_text + else + patch_conflict_detected + fi done ) @@ -47,7 +65,12 @@ done_text="$(tput bold)DONE.$(tput sgr0)" for p in ../../patches/libtock-rs/[0-9][0-9]-*.patch do echo -n '[-] Applying patch "'$(basename $p)'"... ' - git apply "$p" && echo $done_text + if git apply "$p" + then + echo $done_text + else + patch_conflict_detected + fi done ) -- GitLab