Update patch.sh
This commit is contained in:
parent
fc35e86719
commit
a4e472ad78
1 changed files with 2 additions and 25 deletions
27
patch.sh
27
patch.sh
|
|
@ -30,10 +30,6 @@ echo "Config file path: $(pwd)/$CONFIG_FILE"
|
|||
# Read configuration from file
|
||||
. "$(pwd)/$CONFIG_FILE"
|
||||
|
||||
# Get the latest hash
|
||||
echo "Getting latest commit SHA hash"
|
||||
latest_patch_sha=$(curl -s "https://gitgud.io/api/v4/projects/$username%2F$repo/repository/branches/$branch" | jq -r '.commit.id')
|
||||
|
||||
download_extract() {
|
||||
# Download zip file
|
||||
echo "Downloading latest patch..."
|
||||
|
|
@ -49,26 +45,7 @@ download_extract() {
|
|||
echo "Cleaning up..."
|
||||
rm repo.zip
|
||||
rm -rf "$repo-$branch"
|
||||
rm -f latest_patch_sha.txt
|
||||
|
||||
# Store latest SHA for next check
|
||||
echo "$latest_patch_sha" > previous_patch_sha.txt
|
||||
}
|
||||
|
||||
# Check if previous_patch_sha.txt exists
|
||||
if [ ! -f previous_patch_sha.txt ]; then
|
||||
echo "Previous SHA hash not found!"
|
||||
echo "Assuming first time patching..."
|
||||
download_extract
|
||||
else
|
||||
# Read the stored SHA from previous check
|
||||
previous_patch_sha=$(cat previous_patch_sha.txt)
|
||||
|
||||
# Compare trimmed SHAs
|
||||
if [ "$latest_patch_sha" != "$previous_patch_sha" ]; then
|
||||
echo "Update found! Patching..."
|
||||
download_extract
|
||||
else
|
||||
echo "Patch is up to date."
|
||||
fi
|
||||
fi
|
||||
# Download and Patch Files
|
||||
download_extract
|
||||
|
|
|
|||
Loading…
Reference in a new issue