-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·31 lines (25 loc) · 884 Bytes
/
install.sh
File metadata and controls
executable file
·31 lines (25 loc) · 884 Bytes
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
#!/bin/bash
# Stop the script if any command fails
set -e
# Step 1: Build the project using Maven
echo "Building the project using Maven..."
mvn clean package assembly:single
# Check if the build was successful
JAR_FILE="target/analyzer-jar-with-dependencies.jar"
if [[ ! -f "$JAR_FILE" ]]; then
echo "Error: JAR file not found after the build."
exit 1
fi
# Step 2: Copy the JAR file to /usr/local/bin
echo "Installing the JAR file..."
INSTALL_DIR="/usr/local/bin"
INSTALL_JAR="$INSTALL_DIR/analyzer.jar"
sudo cp "$JAR_FILE" "$INSTALL_JAR"
# Step 3: Create a launch script and symbolic link
echo "Creating a symbolic link to launch 'analyzer'..."
sudo bash -c 'cat > /usr/local/bin/analyzer << EOF
#!/bin/bash
java -jar '"$INSTALL_JAR"' "\$@"
EOF'
sudo chmod +x /usr/local/bin/analyzer
echo "Installation complete. You can now run the utility using the 'analyzer' command."