2013-01-15 02:18:40 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2013-01-21 10:24:30 +01:00
|
|
|
basedir=`pwd`
|
2013-01-15 02:18:40 +01:00
|
|
|
echo "Rebuilding Forked projects.... "
|
|
|
|
|
|
|
|
function applyPatch {
|
|
|
|
what=$1
|
|
|
|
target=$2
|
2013-01-19 20:04:56 +01:00
|
|
|
cd $basedir/$what
|
|
|
|
git branch -f upstream >/dev/null
|
|
|
|
|
2013-01-15 02:18:40 +01:00
|
|
|
cd $basedir
|
|
|
|
if [ ! -d "$basedir/$target" ]; then
|
2013-01-19 20:04:56 +01:00
|
|
|
git clone $1 $target -b upstream
|
2013-01-15 02:18:40 +01:00
|
|
|
fi
|
|
|
|
cd "$basedir/$target"
|
|
|
|
echo "Resetting $target to $what..."
|
2013-01-19 20:04:56 +01:00
|
|
|
git remote rm upstream 2>/dev/null 2>&1
|
|
|
|
git remote add upstream ../$what >/dev/null 2>&1
|
|
|
|
git checkout master >/dev/null 2>&1
|
|
|
|
git fetch upstream >/dev/null 2>&1
|
|
|
|
git reset --hard upstream/upstream
|
2013-01-15 02:18:40 +01:00
|
|
|
echo " Applying patches to $target..."
|
|
|
|
git am --3way $basedir/${what}-Patches/*.patch
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo " Something did not apply cleanly to $target."
|
|
|
|
echo " Please review above details and finish the apply then"
|
|
|
|
echo " save the changes with rebuildPatches.sh"
|
2013-01-19 09:18:20 +01:00
|
|
|
exit 1
|
2013-01-15 02:18:40 +01:00
|
|
|
else
|
|
|
|
echo " Patches applied cleanly to $target"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-01-19 09:18:20 +01:00
|
|
|
applyPatch Bukkit Spigot-API && applyPatch CraftBukkit Spigot
|