2014-11-26 05:32:16 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
2014-11-29 07:06:11 +08:00
|
|
|
echo "Please run this script again with the clean decompile sources as an argument. In most cases this will be ../work/decompile-XXXX"
|
|
|
|
exit
|
2014-11-26 05:32:16 +08:00
|
|
|
fi
|
2014-12-04 03:19:09 +08:00
|
|
|
cb=src/main/java/net/minecraft/server
|
|
|
|
nms="$1/net/minecraft/server"
|
2014-11-26 05:32:16 +08:00
|
|
|
|
2014-12-04 03:19:09 +08:00
|
|
|
for file in $(/bin/ls $cb)
|
2014-11-26 05:32:16 +08:00
|
|
|
do
|
2014-11-29 07:06:11 +08:00
|
|
|
echo "Diffing $file"
|
2014-12-04 03:19:09 +08:00
|
|
|
sed -i 's/\r//' "$nms/$file"
|
2014-11-29 07:06:11 +08:00
|
|
|
outName=$(echo nms-patches/"$(echo $file | cut -d. -f1)".patch)
|
2014-12-04 03:19:09 +08:00
|
|
|
patchNew=$(diff -u "$nms/$file" "$cb/$file")
|
2014-11-29 07:06:11 +08:00
|
|
|
if [ -f "$outName" ]
|
|
|
|
then
|
2014-11-29 07:02:15 +08:00
|
|
|
patchCut=$(echo "$patchNew" | tail -n +3)
|
|
|
|
patchOld=$(cat "$outName" | tail -n +3)
|
|
|
|
if [ "$patchCut" != "$patchOld" ] ; then
|
|
|
|
echo "$outName changed"
|
|
|
|
echo "$patchNew" > "$outName"
|
|
|
|
fi
|
2014-11-29 07:06:11 +08:00
|
|
|
else
|
|
|
|
echo "New patch $outName"
|
|
|
|
echo "$patchNew" > "$outName"
|
|
|
|
fi
|
|
|
|
done
|