-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuilder.sh
54 lines (50 loc) · 1.6 KB
/
builder.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
51
52
53
54
#!/bin/bash
# This script requires the following tools:
# - fd-find (or you may replace fd with find)
# - realpath
# - zip
# - krakatau2
# Function to display help message
display_help() {
echo "Usage: $0 [--repackjar | --regenerate-jasm-files | --create-binary | --make-cultris2jar]"
echo "Options:"
echo " --repackjar Repack the cultris2 JAR file"
echo " --regenerate-jasm-files Regenerate jasm files (.j)"
echo " --create-binary-folder Create binary"
echo " --help show help"
exit 1
}
# Check if no arguments provided or if help option requested
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
display_help
fi
# Handle different options
case "$1" in
--repackjar)
if [ -d ./binary ]; then
echo binary folder exists, continueing
rm -f ../cultris2.jar
cd binary || exit
zip -r ../cultris2.jar * && cd ..
else
echo binary folder doesnt exist ... unzipping cultris2.jar
unzip -o ./cultris2.jar -d binary
fi
;;
--regenerate-jasm-files)
unzip -o ./cultris2.jar -d binary
cd binary || exit
# shellcheck disable=SC2046
# passing the paths of all files ending on .class to krak2.
# Once for the output ending on .j, and one for the .class file themselves
fd -e class -x krak2 dis --out $(realpath {}).j $(realpath {})
# shellcheck disable=SC2035
git add *
;;
--create-binary-folder)
unzip -o ./cultris2.jar -d binary
;;
*)
display_help
;;
esac