diff options
-rwxr-xr-x | custom_mutators/gramatron/build_gramatron_mutator.sh | 6 | ||||
-rwxr-xr-x | custom_mutators/grammar_mutator/build_grammar_mutator.sh | 7 | ||||
-rwxr-xr-x | nyx_mode/build_nyx_support.sh | 16 | ||||
-rwxr-xr-x | qemu_mode/build_qemu_support.sh | 7 | ||||
-rwxr-xr-x | unicorn_mode/build_unicorn_support.sh | 7 |
5 files changed, 24 insertions, 19 deletions
diff --git a/custom_mutators/gramatron/build_gramatron_mutator.sh b/custom_mutators/gramatron/build_gramatron_mutator.sh index 677e4548..9952e7f5 100755 --- a/custom_mutators/gramatron/build_gramatron_mutator.sh +++ b/custom_mutators/gramatron/build_gramatron_mutator.sh @@ -115,9 +115,9 @@ if [ $? -eq 0 ]; then git submodule update ./json-c 2>/dev/null # ignore errors else echo "[*] cloning json-c" - test -d json-c || { + test -d json-c/.git || { CNT=1 - while [ '!' -d json-c -a "$CNT" -lt 4 ]; do + while [ '!' -d json-c/.git -a "$CNT" -lt 4 ]; do echo "Trying to clone json-c (attempt $CNT/3)" git clone "$JSONC_REPO" CNT=`expr "$CNT" + 1` @@ -125,7 +125,7 @@ else } fi -test -d json-c || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d json-c/.git || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } echo "[+] Got json-c." test -e json-c/.libs/libjson-c.a || { diff --git a/custom_mutators/grammar_mutator/build_grammar_mutator.sh b/custom_mutators/grammar_mutator/build_grammar_mutator.sh index 452cb0e1..15b8b1db 100755 --- a/custom_mutators/grammar_mutator/build_grammar_mutator.sh +++ b/custom_mutators/grammar_mutator/build_grammar_mutator.sh @@ -109,9 +109,9 @@ if [ $? -eq 0 ]; then git submodule update ./grammar_mutator 2>/dev/null # ignore errors else echo "[*] cloning grammar mutator" - test -d grammar_mutator || { + test -d grammar_mutator/.git || { CNT=1 - while [ '!' -d grammar_mutator -a "$CNT" -lt 4 ]; do + while [ '!' -d grammar_mutator/.git -a "$CNT" -lt 4 ]; do echo "Trying to clone grammar_mutator (attempt $CNT/3)" git clone "$GRAMMAR_REPO" CNT=`expr "$CNT" + 1` @@ -119,11 +119,12 @@ else } fi -test -d grammar_mutator || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d grammar_mutator/.git || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } echo "[+] Got grammar mutator." cd "grammar_mutator" || exit 1 echo "[*] Checking out $GRAMMAR_VERSION" +git pull >/dev/null 2>&1 sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null git checkout "$GRAMMAR_VERSION" || exit 1 echo "[*] Downloading antlr..." diff --git a/nyx_mode/build_nyx_support.sh b/nyx_mode/build_nyx_support.sh index b6c1d54e..3cb13cf1 100755 --- a/nyx_mode/build_nyx_support.sh +++ b/nyx_mode/build_nyx_support.sh @@ -1,6 +1,4 @@ #!/bin/bash -set -e - echo "=================================================" echo " Nyx build script" echo "=================================================" @@ -19,6 +17,7 @@ echo "[*] Making sure all Nyx is checked out" git status 1>/dev/null 2>/dev/null if [ $? -eq 0 ]; then + git submodule init || exit 1 echo "[*] initializing QEMU-Nyx submodule" git submodule update ./QEMU-Nyx 2>/dev/null # ignore errors @@ -28,13 +27,16 @@ if [ $? -eq 0 ]; then git submodule update ./libnyx 2>/dev/null # ignore errors else - echo "[ ] not a git repo..." - exit 1 + + test -d QEMU-Nyx/.git || git clone https://github.com/nyx-fuzz/qemu-nyx QEMU-Nyx + test -d packer/.git || git clone https://github.com/nyx-fuzz/packer + test -d libnyx/.git || git clone https://github.com/nyx-fuzz/libnyx + fi -test -d QEMU-Nyx || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } -test -d packer || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } -test -d libnyx || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d QEMU-Nyx/.git || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d packer/.git || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d libnyx/.git || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } echo "[*] checking packer init.cpio.gz ..." if [ ! -f "packer/linux_initramfs/init.cpio.gz" ]; then diff --git a/qemu_mode/build_qemu_support.sh b/qemu_mode/build_qemu_support.sh index 86ebb4d4..8822770c 100755 --- a/qemu_mode/build_qemu_support.sh +++ b/qemu_mode/build_qemu_support.sh @@ -77,9 +77,9 @@ if [ $? -eq 0 ]; then git submodule update ./qemuafl 2>/dev/null # ignore errors else echo "[*] cloning qemuafl" - test -d qemuafl || { + test -d qemuafl/.git || { CNT=1 - while [ '!' -d qemuafl -a "$CNT" -lt 4 ]; do + while [ '!' -d qemuafl/.git -a "$CNT" -lt 4 ]; do echo "Trying to clone qemuafl (attempt $CNT/3)" git clone --depth 1 https://github.com/AFLplusplus/qemuafl CNT=`expr "$CNT" + 1` @@ -87,7 +87,7 @@ else } fi -test -d qemuafl || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d qemuafl/.git || { echo "[-] Not checked out, please install git or check your internet connection." ; exit 1 ; } echo "[+] Got qemuafl." cd "qemuafl" || exit 1 @@ -96,6 +96,7 @@ if [ -n "$NO_CHECKOUT" ]; then else echo "[*] Checking out $QEMUAFL_VERSION" sh -c 'git stash' 1>/dev/null 2>/dev/null + git pull git checkout "$QEMUAFL_VERSION" || echo Warning: could not check out to commit $QEMUAFL_VERSION fi diff --git a/unicorn_mode/build_unicorn_support.sh b/unicorn_mode/build_unicorn_support.sh index 74f9e174..80961599 100755 --- a/unicorn_mode/build_unicorn_support.sh +++ b/unicorn_mode/build_unicorn_support.sh @@ -161,9 +161,9 @@ if [ $? -eq 0 ]; then git submodule sync ./unicornafl 2>/dev/null # ignore errors else echo "[*] cloning unicornafl" - test -d unicornafl || { + test -d unicornafl/.git || { CNT=1 - while [ '!' -d unicornafl -a "$CNT" -lt 4 ]; do + while [ '!' -d unicornafl/.git -a "$CNT" -lt 4 ]; do echo "Trying to clone unicornafl (attempt $CNT/3)" git clone https://github.com/AFLplusplus/unicornafl CNT=`expr "$CNT" + 1` @@ -171,11 +171,12 @@ else } fi -test -d unicornafl || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } +test -d unicornafl/.git || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } echo "[+] Got unicornafl." cd "unicornafl" || exit 1 echo "[*] Checking out $UNICORNAFL_VERSION" +git pull sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null git checkout "$UNICORNAFL_VERSION" || exit 1 |