flrender.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/usr/bin/env sh
  2. set -e #-x
  3. # This script is to run the flrender tool to generate new adblocker lists
  4. # from AdBlocker-rules.template.
  5. # Since Github have choosen to disable the Actions (GHA) we will be running
  6. # this code directly on My Privacy DNS's server by using conda
  7. # First check if conda is installed
  8. # We use git dir to make it CI independent
  9. GIT_DIR="$(git rev-parse --show-toplevel)"
  10. BUILD="$(git rev-parse --short HEAD)"
  11. # Goto repo root
  12. cd "${GIT_DIR}"
  13. # Remove old blocklist
  14. if [ -f _public/blockrules.txt ]; then rm -f _public/blockrules.txt; fi
  15. ls -lha _public/
  16. # Render the rules
  17. flrender -v -i ublockorigin-rules=. adblocker-rules.template _public/blockrules.txt
  18. ls -lha _public/
  19. head -n 5 _public/blockrules.txt
  20. sed -i -e "s/\! BuildID:/\! BuildID: $BUILD/g" _public/blockrules.txt
  21. head -n 5 _public/blockrules.txt
  22. # git add _public/blockrules.txt && git commit -am "New build"
  23. # git push "https://spirillen:${CI_ACCESS_TOKEN}@${CI_REPOSITORY_URL#*@}" "HEAD:${CI_COMMIT_REF_NAME}" -o skip-ci
  24. # Copyright: https://mypdns.org/
  25. # Content: https://mypdns.org/spirillen/
  26. # Source: https://github.com/mypdns/adblocker-rules
  27. # License: https://github.com/mypdns/adblocker-rules/blob/master/LICENSE.md
  28. # License: MCRAE GENERAL PUBLIC LICENSE (version 4.r53m2)
  29. #
  30. # You should have received a copy of the license along with this work.