about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules3
-rwxr-xr-xunicorn_mode/build_unicorn_support.sh33
m---------unicorn_mode/unicornafl0
4 files changed, 25 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index c8a92b7d..5a7f9408 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,7 +42,6 @@ qemu_mode/libcompcov/compcovtest
 as
 ld
 qemu_mode/qemu-*
-unicorn_mode/unicornafl/
 unicorn_mode/samples/*/\.test-*
 unicorn_mode/samples/*/output/
 core\.*
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..2292a6df
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "unicorn_mode/unicornafl"]
+	path = unicorn_mode/unicornafl
+	url = git@github.com:AFLplusplus/unicornafl.git
diff --git a/unicorn_mode/build_unicorn_support.sh b/unicorn_mode/build_unicorn_support.sh
index 8297e13f..0c84c07b 100755
--- a/unicorn_mode/build_unicorn_support.sh
+++ b/unicorn_mode/build_unicorn_support.sh
@@ -33,7 +33,7 @@
 # You must make sure that Unicorn Engine is not already installed before
 # running this script. If it is, please uninstall it first.
 
-UNICORNAFL_VERSION='afl++2.64c'
+UNICORNAFL_VERSION="$(cat ./UNICORNAFL_VERSION)"
 
 echo "================================================="
 echo "UnicornAFL build script"
@@ -146,21 +146,32 @@ fi
 echo "[+] All checks passed!"
 
 echo "[*] Making sure unicornafl is checked out"
-rm -rf unicornafl # workaround for travis ... sadly ...
-#test -d unicorn && { cd unicorn && { git stash ; git pull ; cd .. ; } }
-test -d unicornafl || {
-   CNT=1
-   while [ '!' -d unicornafl -a "$CNT" -lt 4 ]; do
-     echo "Trying to clone unicornafl (attempt $CNT/3)"
-     git clone https://github.com/AFLplusplus/unicornafl
-     CNT=`expr "$CNT" + 1`
-   done
-}
+
+git status 1>/dev/null 2>/dev/null
+if [ $? -eq 0 ]; then
+  echo "[*] initializing unicornafl submodule"
+  git submodule init || exit 1
+  git submodule update 2>/dev/null # ignore errors
+else
+  echo "[*] cloning unicornafl"
+  rm -rf unicornafl # workaround for travis ... sadly ...
+  #test -d unicorn && { cd unicorn && { git stash ; git pull ; cd .. ; } }
+  test -d unicornafl || {
+    CNT=1
+    while [ '!' -d unicornafl -a "$CNT" -lt 4 ]; do
+      echo "Trying to clone unicornafl (attempt $CNT/3)"
+      git clone https://github.com/AFLplusplus/unicornafl
+      CNT=`expr "$CNT" + 1`
+    done
+  }
+fi
+
 test -d unicornafl || { 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"
+sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null
 git checkout "$UNICORNAFL_VERSION" || exit 1
 
 echo "[*] making sure config.h matches"
diff --git a/unicorn_mode/unicornafl b/unicorn_mode/unicornafl
new file mode 160000
+Subproject 89fd1f66912c8e0918ba0658b16bda204607e44