-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
blueberry
executable file
·86 lines (83 loc) · 2.43 KB
/
blueberry
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
echo ""
echo "WARNING: This tool is deprecated and will be removed in the future."
echo ""
# 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
)
;;
"prb" | "patchAndRebuild")
(
set -e
cd "$basedir"
scripts/applyPatches.sh || exit 1
scripts/rebuildPatches.sh || exit 1
)
;;
"i" | "installer")
(
set -e
cd "$basedir"
BN=$2
if [ -z "$BN" ]; then
BN="0"
fi
scripts/build.sh $BN || exit 1
scripts/createPatchFile.sh || exit 1
scripts/createInstaller.sh $BN || exit 1
)
;;
"b" | "build")
(
set -e
cd "$basedir"
scripts/init.sh || exit 1
scripts/build.sh || exit 1
scripts/createPatchFile.sh || exit 1
scripts/createInstaller.sh || exit 1
)
;;
*)
echo "Blueberry build tool command. This provides a easy way to build, and manage Blueberry 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."
echo " * prb, patchAndRebuild | Apply all patches to the project and rebuild patches. Useful when you modified the small part of a patch file."
echo " * i, installer [number] | Creates installer. The project must be patched before doing this."
echo " * b, build | Builds the project and creates installer (equivalent as patch & installer)."
;;
esac