Finish updater for allpac
This commit is contained in:
parent
1286efdf01
commit
8e81a96403
|
@ -1,19 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define the repository and binary path
|
||||
# Define the repository, binary path, and version URL
|
||||
REPO_URL="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/AllPac.git"
|
||||
BINARY_PATH="$HOME/.allpac/bin/allpac"
|
||||
VERSION_URL="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/AllPac/raw/branch/main/.version"
|
||||
|
||||
# Step 1: Clone the repository
|
||||
# Step 1: Check the current version of AllPac
|
||||
local_version=$(allpac version 2>/dev/null)
|
||||
echo "Current installed version: $local_version"
|
||||
|
||||
# Fetch the latest version from the server
|
||||
latest_version=$(curl -s "$VERSION_URL")
|
||||
echo "Latest available version: $latest_version"
|
||||
|
||||
# Compare versions
|
||||
if [ "$local_version" = "$latest_version" ]; then
|
||||
echo "No Need to Update."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Step 2: 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 "Ensuring we have up to date depends..."
|
||||
go mod tidy
|
||||
|
||||
echo "Building the new binary..."
|
||||
go build -o allpac_new
|
||||
|
||||
# Step 3: Replace the old binary with the new one
|
||||
# Step 4: Replace the old binary with the new one
|
||||
if [ -f "$BINARY_PATH" ]; then
|
||||
echo "Replacing the old binary..."
|
||||
mv allpac_new "$BINARY_PATH"
|
||||
|
@ -23,7 +40,7 @@ else
|
|||
mv allpac_new "$BINARY_PATH"
|
||||
fi
|
||||
|
||||
# Step 4: Clean up
|
||||
# Step 5: Clean up
|
||||
echo "Cleaning up..."
|
||||
cd ../../
|
||||
rm -rf AllPacUpdate
|
||||
|
|
Loading…
Reference in New Issue
Block a user