fix grammar download script

This commit is contained in:
van Hauser
2020-12-08 12:36:19 +01:00
parent 8999023432
commit 6d2ac3e314

View File

@ -106,36 +106,35 @@ git status 1>/dev/null 2>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "[*] initializing grammar mutator submodule" echo "[*] initializing grammar mutator submodule"
git submodule init || exit 1 git submodule init || exit 1
git submodule update ./grammar_mutator 2>/dev/null # ignore errors git submodule update ./grammar-mutator 2>/dev/null # ignore errors
else else
echo "[*] cloning grammar mutator" echo "[*] cloning grammar mutator"
test -d grammar_mutator || { test -d grammar-mutator || {
CNT=1 CNT=1
while [ '!' -d grammar_mutator -a "$CNT" -lt 4 ]; do while [ '!' -d grammar-mutator -a "$CNT" -lt 4 ]; do
echo "Trying to clone grammar_mutator (attempt $CNT/3)" echo "Trying to clone grammar-mutator (attempt $CNT/3)"
git clone "$GRAMMAR_REPO" git clone "$GRAMMAR_REPO"
CNT=`expr "$CNT" + 1` CNT=`expr "$CNT" + 1`
done done
} }
fi fi
test -d grammar_mutator || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; } test -d grammar-mutator || { echo "[-] not checked out, please install git or check your internet connection." ; exit 1 ; }
echo "[+] Got grammar mutator." echo "[+] Got grammar mutator."
cd "grammar_mutator" || exit 1 cd "grammar-mutator" || exit 1
echo "[*] Checking out $GRAMMAR_VERSION" echo "[*] Checking out $GRAMMAR_VERSION"
sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null sh -c 'git stash && git stash drop' 1>/dev/null 2>/dev/null
git checkout "$GRAMMAR_VERSION" || exit 1 git checkout "$GRAMMAR_VERSION" || exit 1
cd ..
echo "[*] Downloading antlr..." echo "[*] Downloading antlr..."
wget -c https://www.antlr.org/download/antlr-4.8-complete.jar wget -c https://www.antlr.org/download/antlr-4.8-complete.jar
cd ..
echo echo
echo echo
echo "[+] All successfully prepared!" echo "[+] All successfully prepared!"
echo "[!] To build for your grammar just do:" echo "[!] To build for your grammar just do:"
echo " `cd grammar_mutator`" echo " cd grammar-mutator"
echo " `make GRAMMAR_FILE=/path/to/your/grammar`" echo " make GRAMMAR_FILE=/path/to/your/grammar"
echo "[+] You will find a JSON and RUBY grammar in grammar_mutator/grammars to play with." echo "[+] You will find a JSON and RUBY grammar in grammar-mutator/grammars to play with."
echo echo