Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add license to bash script #37

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .internal/aws/scripts/dist.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
3 changes: 3 additions & 0 deletions tests/scripts/black.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/docker/black.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/docker/flake8.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/docker/isort.sh
Original file line number Diff line number Diff line change
@@ -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 ]]
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/docker/mypy.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/docker/run_tests.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/flake8.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/isort.sh
Original file line number Diff line number Diff line change
@@ -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 ]]
Expand Down
24 changes: 20 additions & 4 deletions tests/scripts/license_headers_check.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/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
echo "Usage: $0 check|fix"
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")
Expand All @@ -16,14 +19,27 @@ do
then
echo fix "$FILE"
TMPFILE=$(mktemp /tmp/license.XXXXXXXXXX)
cat <<EOF > "$TMPFILE"
if [[ "$FILE" == *".sh" && $(grep "#!/usr/bin/env bash" "$FILE") ]]
then
cat <<EOF > "$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 <<EOF > "$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"
Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/mypy.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 3 additions & 0 deletions tests/scripts/run_tests.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down