default-seccomp 770 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. source "${SCRIPTDIR}/.validate"
  4. IFS=$'\n'
  5. files=( $(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true) )
  6. unset IFS
  7. if [ ${#files[@]} -gt 0 ]; then
  8. # We run 'go generate' and see if we have a diff afterwards
  9. go generate ./profiles/seccomp/ >/dev/null
  10. # Let see if the working directory is clean
  11. diffs="$(git status --porcelain -- profiles/seccomp 2>/dev/null)"
  12. if [ "$diffs" ]; then
  13. {
  14. echo 'The result of go generate ./profiles/seccomp/ differs'
  15. echo
  16. echo "$diffs"
  17. echo
  18. echo 'Please re-run go generate ./profiles/seccomp/'
  19. echo
  20. } >&2
  21. false
  22. else
  23. echo 'Congratulations! Seccomp profile generation is done correctly.'
  24. fi
  25. fi