update.sh 847 B

12345678910111213141516171819202122232425262728
  1. #/bin/bash
  2. repo_url="https://github.com/go-acme/lego"
  3. # Check if the folder "./lego" exists
  4. if [ -d "./lego" ]; then
  5. # If the folder exists, change into it and perform a git pull
  6. echo "Folder './lego' exists. Pulling updates..."
  7. cd "./lego" || exit
  8. git pull
  9. cd ../
  10. else
  11. # If the folder doesn't exist, clone the repository
  12. echo "Folder './lego' does not exist. Cloning the repository..."
  13. git clone "$repo_url" "./lego" || exit
  14. fi
  15. # Run the extract.go to get all the config from lego source code
  16. echo "Generating code"
  17. go run ./extract.go
  18. # go run ./extract.go -- "win7"
  19. echo "Cleaning up lego"
  20. sleep 2
  21. # Comment the line below if you dont want to pull everytime update
  22. # This is to help go compiler to not load all the lego source file when compile
  23. #rm -rf ./lego/
  24. echo "Config generated"