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