forked from BlueberryMC/MagmaCube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
magmacube
executable file
·58 lines (56 loc) · 1.77 KB
/
magmacube
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
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
# resolve shell-specifics
case "$(echo "$SHELL" | sed -E 's|/usr(/local)?||g')" in
"/bin/zsh")
RCPATH="$HOME/.zshrc"
SOURCE="${BASH_SOURCE[0]:-${(%):-%N}}"
;;
*)
RCPATH="$HOME/.bashrc"
if [[ -f "$HOME/.bash_aliases" ]]; then
RCPATH="$HOME/.bash_aliases"
fi
SOURCE="${BASH_SOURCE[0]}"
;;
esac
# get base dir regardless of execution location
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
SOURCE=$([[ "$SOURCE" = /* ]] && echo "$SOURCE" || echo "$PWD/${SOURCE#./}")
basedir=$(dirname "$SOURCE")
case "$1" in
"rb" | "rbp" | "rebuild")
(
set -e
cd "$basedir"
scripts/rebuildPatches.sh || exit 1
)
;;
"p" | "patch")
(
set -e
cd "$basedir"
scripts/init.sh || exit 1
)
;;
"runclient" | "client" | "run")
(
set -e
cd "$basedir"
scripts/build.sh || exit 1
scripts/runClient.sh || exit 1
)
;;
*)
echo "MagmaCube build tool command. This provides a easy way to build, and manage MagmaCube Project."
echo ""
echo " Commands:"
echo " * rb, rebuild | Rebuild patches, can be called from anywhere."
echo " * p, patch | Apply all patches to the project without building it. Can be run from anywhere."
echo " * run, client, runclient | Builds project and run the client. You must do patch before doing this."
echo " * j, jar | Apply all patches and build the project. (Not available yet)"
;;
esac