From 5df4216006fae935e5f849f8c8b30b328aad90c2 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Wed, 24 Nov 2021 16:28:16 +0100 Subject: [PATCH] add license to bash script --- .internal/aws/scripts/dist.sh | 3 +++ tests/entrypoint.sh | 3 +++ tests/scripts/black.sh | 3 +++ tests/scripts/docker/black.sh | 3 +++ tests/scripts/docker/flake8.sh | 3 +++ tests/scripts/docker/isort.sh | 3 +++ tests/scripts/docker/mypy.sh | 3 +++ tests/scripts/docker/run_tests.sh | 3 +++ tests/scripts/flake8.sh | 3 +++ tests/scripts/isort.sh | 3 +++ tests/scripts/license_headers_check.sh | 24 ++++++++++++++++++++---- tests/scripts/mypy.sh | 3 +++ tests/scripts/run_tests.sh | 3 +++ 13 files changed, 56 insertions(+), 4 deletions(-) diff --git a/.internal/aws/scripts/dist.sh b/.internal/aws/scripts/dist.sh index 23837504..7a96f075 100755 --- a/.internal/aws/scripts/dist.sh +++ b/.internal/aws/scripts/dist.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e diff --git a/tests/entrypoint.sh b/tests/entrypoint.sh index 3b48b201..fa9c76e9 100755 --- a/tests/entrypoint.sh +++ b/tests/entrypoint.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. export HOME=/home/user exec /usr/local/bin/gosu user "$@" diff --git a/tests/scripts/black.sh b/tests/scripts/black.sh index f200629a..7309ff81 100755 --- a/tests/scripts/black.sh +++ b/tests/scripts/black.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e if [[ $# -eq 0 ]] then diff --git a/tests/scripts/docker/black.sh b/tests/scripts/docker/black.sh index ef7152b4..dcf5f72c 100755 --- a/tests/scripts/docker/black.sh +++ b/tests/scripts/docker/black.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. pip_cache="$HOME/.cache" docker_pip_cache="/tmp/cache/pip" diff --git a/tests/scripts/docker/flake8.sh b/tests/scripts/docker/flake8.sh index 5be923a6..25530f60 100755 --- a/tests/scripts/docker/flake8.sh +++ b/tests/scripts/docker/flake8.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e diff --git a/tests/scripts/docker/isort.sh b/tests/scripts/docker/isort.sh index 4b48f397..a73435e0 100755 --- a/tests/scripts/docker/isort.sh +++ b/tests/scripts/docker/isort.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e if [[ $# -eq 0 ]] diff --git a/tests/scripts/docker/mypy.sh b/tests/scripts/docker/mypy.sh index cb4c90f1..352cd6c7 100755 --- a/tests/scripts/docker/mypy.sh +++ b/tests/scripts/docker/mypy.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e diff --git a/tests/scripts/docker/run_tests.sh b/tests/scripts/docker/run_tests.sh index 2f81bdb3..2d2a960b 100755 --- a/tests/scripts/docker/run_tests.sh +++ b/tests/scripts/docker/run_tests.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -ex pip_cache="$HOME/.cache" diff --git a/tests/scripts/flake8.sh b/tests/scripts/flake8.sh index ace17c0b..0b0849c7 100755 --- a/tests/scripts/flake8.sh +++ b/tests/scripts/flake8.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e diff --git a/tests/scripts/isort.sh b/tests/scripts/isort.sh index 181c7088..a66773c6 100755 --- a/tests/scripts/isort.sh +++ b/tests/scripts/isort.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e if [[ $# -eq 0 ]] diff --git a/tests/scripts/license_headers_check.sh b/tests/scripts/license_headers_check.sh index 508fefcd..9641c2d7 100755 --- a/tests/scripts/license_headers_check.sh +++ b/tests/scripts/license_headers_check.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. if [[ $# -eq 0 ]] then @@ -6,7 +9,7 @@ then exit 1 fi -FILES=$(find . -iname "*.py" -not -path "./venv/*") +FILES=$(find . \( -iname "*.py" -or -iname "*.sh" \) -not -path "./venv/*") for FILE in $FILES do MISSING=$(grep --files-without-match "Licensed under the Elastic License 2.0" "$FILE") @@ -16,14 +19,27 @@ do then echo fix "$FILE" TMPFILE=$(mktemp /tmp/license.XXXXXXXXXX) - cat < "$TMPFILE" + if [[ "$FILE" == *".sh" && $(grep "#!/usr/bin/env bash" "$FILE") ]] + then + cat < "$TMPFILE" +#!/usr/bin/env bash # Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one # or more contributor license agreements. Licensed under the Elastic License 2.0; # you may not use this file except in compliance with the Elastic License 2.0. - EOF - cat "$FILE" >> "$TMPFILE" + tail -n +2 "$FILE" >> "$TMPFILE" mv "$TMPFILE" "$FILE" + chmod 755 "$FILE" + else + cat < "$TMPFILE" +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. + +EOF + cat "$FILE" >> "$TMPFILE" + mv "$TMPFILE" "$FILE" + fi else echo "File with missing copyright header:" echo "$MISSING" diff --git a/tests/scripts/mypy.sh b/tests/scripts/mypy.sh index 2e97b2ce..219bdc5b 100755 --- a/tests/scripts/mypy.sh +++ b/tests/scripts/mypy.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -e diff --git a/tests/scripts/run_tests.sh b/tests/scripts/run_tests.sh index 0e423406..a3346a7c 100755 --- a/tests/scripts/run_tests.sh +++ b/tests/scripts/run_tests.sh @@ -1,4 +1,7 @@ #!/usr/bin/env bash +# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +# or more contributor license agreements. Licensed under the Elastic License 2.0; +# you may not use this file except in compliance with the Elastic License 2.0. set -ex