32 lines
846 B
Bash
32 lines
846 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Define the repository and binary path
|
||
|
REPO_URL="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/AllPac.git"
|
||
|
BINARY_PATH="$HOME/.allpac/bin/allpac"
|
||
|
|
||
|
# Step 1: Clone the repository
|
||
|
echo "Cloning the repository..."
|
||
|
git clone "$REPO_URL" AllPacUpdate
|
||
|
cd AllPacUpdate/cmd/ || { echo "Failed to enter the repository directory. Exiting."; exit 1; }
|
||
|
|
||
|
# Step 2: Build the new binary
|
||
|
echo "Building the new binary..."
|
||
|
go build -o allpac_new
|
||
|
|
||
|
# Step 3: Replace the old binary with the new one
|
||
|
if [ -f "$BINARY_PATH" ]; then
|
||
|
echo "Replacing the old binary..."
|
||
|
mv allpac_new "$BINARY_PATH"
|
||
|
else
|
||
|
echo "Binary not found. Installing the new binary..."
|
||
|
mkdir -p "$(dirname "$BINARY_PATH")"
|
||
|
mv allpac_new "$BINARY_PATH"
|
||
|
fi
|
||
|
|
||
|
# Step 4: Clean up
|
||
|
echo "Cleaning up..."
|
||
|
cd ../../
|
||
|
rm -rf AllPacUpdate
|
||
|
|
||
|
echo "Update complete."
|