forked from kubernetes-sigs/kustomize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd-license.sh
More file actions
executable file
·47 lines (42 loc) · 950 Bytes
/
add-license.sh
File metadata and controls
executable file
·47 lines (42 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
set -x
set -e
set -o pipefail
set -o nounset
if [[ -z "${1-}" ]] ; then
echo "Usage: $0 <mode>"
echo "Example: $0 check"
exit 1
fi
if [[ $1 == "check" || $1 == "run" ]]; then
mode=$1
else
echo "Error: mode must be check or run"
exit 1
fi
args=(
-y $(date +"%Y")
-c "The Kubernetes Authors."
-f LICENSE_TEMPLATE
-ignore "kyaml/internal/forked/github.com/**/*"
-ignore "site/**/*"
-ignore "**/*.md"
-ignore "**/*.json"
-ignore "**/*.yml"
-ignore "**/*.yaml"
-ignore "**/*.xml"
-v
)
if [[ $mode == "check" ]]; then
args+=(-check)
if ! addlicense "${args[@]}" . ; then
set +x
echo -e "\n------------------------------------------------------------------------"
echo "Error: license missing in one or more files. Run \`$0 run\` to update them."
exit 1
fi
exit 0
fi
addlicense "${args[@]}" .