From d4d0adb297fcc8d2519c64a50d433e18f0f8e438 Mon Sep 17 00:00:00 2001 From: Zen Wen Date: Sat, 30 Aug 2025 14:28:10 +0800 Subject: [PATCH] Update acme code-gen Script: update.sh Change the pull branch to latest version tags Avoid generating config that not include in the latest lego release --- tools/dns_challenge_update/code-gen/update.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/dns_challenge_update/code-gen/update.sh b/tools/dns_challenge_update/code-gen/update.sh index 8898d63..ea57cfc 100755 --- a/tools/dns_challenge_update/code-gen/update.sh +++ b/tools/dns_challenge_update/code-gen/update.sh @@ -2,17 +2,21 @@ repo_url="https://github.com/go-acme/lego" +# Get the latest lego version +version=$(curl -s https://api.github.com/repos/go-acme/lego/releases/latest | grep tag_name | cut -d '"' -f 4) + # Check if the folder "./lego" exists if [ -d "./lego" ]; then # If the folder exists, change into it and perform a git pull echo "Folder './lego' exists. Pulling updates..." cd "./lego" || exit git pull + git switch --detach "$version" cd ../ else # If the folder doesn't exist, clone the repository echo "Folder './lego' does not exist. Cloning the repository..." - git clone "$repo_url" "./lego" || exit + git clone --branch "$version" "$repo_url" "./lego" || exit fi # Run the extract.go to get all the config from lego source code @@ -26,4 +30,3 @@ sleep 2 # This is to help go compiler to not load all the lego source file when compile #rm -rf ./lego/ echo "Config generated" -