From 202b176b5e6feaa737f583836ffb88eb3913684a Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Fri, 22 Jan 2021 15:31:40 +0000 Subject: [PATCH] Skip picotool and picoprobe if they already exist --- pico_setup.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/pico_setup.sh b/pico_setup.sh index 4a928d7..a109e91 100755 --- a/pico_setup.sh +++ b/pico_setup.sh @@ -101,22 +101,27 @@ cd $OUTDIR for REPO in picoprobe picotool do DEST="$OUTDIR/$REPO" - REPO_URL="${GITHUB_PREFIX}${REPO}${GITHUB_SUFFIX}" - git clone $REPO_URL - - # Build both - cd $DEST - mkdir build - cd build - cmake ../ - make -j$JNUM - if [[ "$REPO" == "picotool" ]]; then - echo "Installing picotool to /usr/local/bin/picotool" - sudo cp picotool /usr/local/bin/ - fi + if [ -d $DEST ]; then + echo "$DEST already exists so skipping" + else + REPO_URL="${GITHUB_PREFIX}${REPO}${GITHUB_SUFFIX}" + git clone $REPO_URL - cd $OUTDIR + # Build both + cd $DEST + mkdir build + cd build + cmake ../ + make -j$JNUM + + if [[ "$REPO" == "picotool" ]]; then + echo "Installing picotool to /usr/local/bin/picotool" + sudo cp picotool /usr/local/bin/ + fi + + cd $OUTDIR + fi done if [ -d openocd ]; then