forked from BuildCLI/BuildCLI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
52 lines (41 loc) · 1.19 KB
/
install.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
#!/bin/bash
set -e
function check_command() {
if ! command -v "$1" &> /dev/null; then
echo "$1 is not installed, please install it before proceeding."
exit 1
fi
}
check_command java
check_command mvn
if ! git clone https://github.com/BuildCLI/BuildCLI.git ; then
echo "Failed to clone repository. Make sure Git is installed."
exit 1
fi
cd BuildCLI
if ! mvn clean package; then
echo "Error while creating Maven package."
exit 1
fi
if [ ! -d "$HOME/bin" ]; then
mkdir -p "$HOME/bin"
fi
cp target/buildcli.jar "$HOME/bin/"
cat <<EOF > "$HOME/bin/buildcli"
#!/bin/bash
java -jar "\$HOME/bin/buildcli.jar" "\$@"
EOF
chmod +x "$HOME/bin/buildcli"
if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
echo "The directory \$HOME/bin is not in the PATH."
echo "Please add the following line to your ~/.bashrc, ~/.zshrc, or the appropriate shell configuration file:"
echo ""
echo 'export PATH="$HOME/bin:$PATH"'
echo ""
echo "Then, reload your shell with:"
echo "source ~/.bashrc # or source ~/.zshrc if you use Zsh"
echo ""
echo "After that, you can run the application with: buildcli"
else
echo "You can now run the application with: buildcli"
fi