Yatopia/scripts/upstream.sh

61 lines
1.6 KiB
Bash
Raw Normal View History

2020-02-26 17:23:57 +01:00
#!/bin/bash
# get base dir regardless of execution location
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
. $(dirname $SOURCE)/init.sh
if [[ "$1" == up* ]]; then
(
2020-03-21 17:29:35 +01:00
cd "$basedir/Tuinity/"
2020-02-26 17:23:57 +01:00
git fetch && git reset --hard origin/ver/1.14
cd ../
2020-03-21 17:29:35 +01:00
git add Tuinity
2020-02-26 17:23:57 +01:00
)
fi
2020-03-21 17:29:35 +01:00
tuinityVer=$(gethead Tuinity)
cd "$basedir/Tuinity/"
2020-02-26 17:23:57 +01:00
2020-03-21 17:29:35 +01:00
./tuinity patch
2020-02-26 17:23:57 +01:00
2020-03-21 17:29:35 +01:00
cd "Tuinity-Server"
2020-02-26 17:23:57 +01:00
mcVer=$(mvn -o org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=minecraft_version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }')
basedir
. $basedir/scripts/importmcdev.sh
2020-03-21 17:29:35 +01:00
minecraftversion=$(cat $basedir/Tuinity/work/BuildData/info.json | grep minecraftVersion | cut -d '"' -f 4)
version=$(echo -e "Tuinity: $tuinityVer\nmc-dev:$importedmcdev")
2020-02-26 17:23:57 +01:00
tag="${minecraftversion}-${mcVer}-$(echo -e $version | shasum | awk '{print $1}')"
2020-03-21 17:29:35 +01:00
echo "$tag" > $basedir/current-tuinity
git add "$basedir/current-tuinity"
2020-02-26 17:23:57 +01:00
$basedir/scripts/generatesources.sh
2020-03-21 17:29:35 +01:00
cd Tuinity/
2020-02-26 17:23:57 +01:00
function tag {
(
cd $1
if [ "$2" == "1" ]; then
git tag -d "$tag" 2>/dev/null
fi
echo -e "$(date)\n\n$version" | git tag -a "$tag" -F - 2>/dev/null
)
}
echo "Tagging as $tag"
echo -e "$version"
forcetag=0
2020-03-21 17:29:35 +01:00
if [ "$(cat $basedir/current-tuinity)" != "$tag" ]; then
2020-02-26 17:23:57 +01:00
forcetag=1
fi
2020-03-21 17:29:35 +01:00
tag Tuinity-API $forcetag
tag Tuinity-Server $forcetag
2020-02-26 17:23:57 +01:00