-
Notifications
You must be signed in to change notification settings - Fork 3
/
apply_patches.sh
executable file
·50 lines (42 loc) · 1.26 KB
/
apply_patches.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
basedir=`pwd`
tg_tag="3.4.0"
echo "Checking for TG rust-g repo.."
if [ ! -d "./tg-rust-g" ]
then
echo "TG rust-g does not exist locally. Cloning..."
git clone https://github.com/tgstation/rust-g.git tg-rust-g
fi
echo "Setting up project... "
cd "$basedir/tg-rust-g"
git fetch
git reset --hard $tg_tag
apply_patch() {
what=$1
target=$2
branch=$3
cd "$basedir"
if [ ! -d "$target" ]; then
git clone $what $target
fi
cd "$basedir/$target"
echo "Resetting $target to $what..."
git config commit.gpgSign false
git remote rm origin >/dev/null 2>&1
git remote add origin ../$what >/dev/null 2>&1
git checkout master >/dev/null 2>&1
git fetch origin >/dev/null 2>&1
git reset --hard $branch
echo " Applying patches to $target..."
git am --abort >/dev/null 2>&1
git am --3way --ignore-space-change --ignore-whitespace "../${target}-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 rebuild_patches.sh"
exit 1
else
echo " Patches applied cleanly to $target"
fi
}
apply_patch tg-rust-g paradise-rust-g $tg_tag