2015-08-09 02:28:31 +00:00
|
|
|
#!/bin/sh
|
|
|
|
CS_URL="$1" # url
|
|
|
|
CS_BRA="$2" # branch name
|
|
|
|
CS_TIP="$3" # tip commit
|
|
|
|
CS_REV="$4" # revert
|
|
|
|
|
|
|
|
if [ -d capstone -a ! -d capstone/.git ]; then
|
|
|
|
echo "[capstone] release with no git?"
|
2016-08-22 23:46:07 +00:00
|
|
|
cd capstone
|
|
|
|
for PATCH in ../capstone-patches/* ; do
|
|
|
|
patch -Rp1 < $PATCH
|
|
|
|
done
|
2015-08-09 02:28:31 +00:00
|
|
|
else
|
|
|
|
if [ ! -d capstone ]; then
|
2017-01-16 00:36:37 +00:00
|
|
|
git clone -b next --depth 10 "${CS_URL}" capstone || exit 1
|
2015-08-09 02:28:31 +00:00
|
|
|
fi
|
|
|
|
cd capstone || exit 1
|
|
|
|
if [ -n "${CS_REV}" ]; then
|
|
|
|
HEAD="`git log|grep ^commit | head -n2|tail -n1 | awk '{print $2}'`"
|
|
|
|
else
|
2015-08-13 18:20:06 +00:00
|
|
|
HEAD="`git log|head -n1 | awk '{print $2}'`"
|
2015-08-09 02:28:31 +00:00
|
|
|
fi
|
|
|
|
if [ "${HEAD}" = "${CS_TIP}" ]; then
|
|
|
|
echo "[capstone] Already in TIP, no need to update from git"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo "[capstone] Updating capstone from git..."
|
|
|
|
echo "HEAD ${HEAD}"
|
|
|
|
echo "TIP ${CS_TIP}"
|
|
|
|
|
2016-02-27 14:10:16 +00:00
|
|
|
git reset --hard HEAD^^^
|
2015-10-01 10:04:58 +00:00
|
|
|
git checkout "${CS_BRA}" || exit 1
|
2015-08-09 02:28:31 +00:00
|
|
|
git pull
|
|
|
|
if [ -n "${CS_TIP}" ]; then
|
|
|
|
git reset --hard "${CS_TIP}"
|
|
|
|
fi
|
|
|
|
if [ -n "${CS_REV}" ]; then
|
|
|
|
if ! git config user.name ; then
|
|
|
|
git config user.name "radare-travis"
|
|
|
|
git config user.email "radare-travis@foo.com"
|
|
|
|
fi
|
|
|
|
EDITOR=cat git revert --no-edit ${CS_REV}
|
|
|
|
fi
|
|
|
|
fi
|