forked from secureCodeBox/secureCodeBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-license-header.sh
executable file
·47 lines (40 loc) · 1018 Bytes
/
add-license-header.sh
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
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
#
# Add SPDX license header to given list off files
#
# Prerequisites:
# - reuse tool
#
# Usage:
# add-license-header.sh file1 file2 file3
#
# Example to read from linter file (IMPORTANT: You must remove all the markdown clutter to get palin list of files):
# cat spdx-report.md | ./add-license-header.sh
#
# To generate the file list use `reuse lint`. This produces a Markdown report:
# docker run --rm --volume $(pwd):/data fsfe/reuse lint > spdx-report.md
#
# See also:
# - https://spdx.org
# - https://reuse.software
#
set -eu
echo "Adding Header to all files..."
FILES=""
if [[ -p /dev/stdin ]]; then
FILES="$(cat -)"
else
FILES="$@"
fi
for file in $FILES; do
echo "Adding HEADER to file: $file"
docker run --rm --volume $(pwd):/data fsfe/reuse annotate \
--copyright "iteratec GmbH" \
--year 2023 \
--license "Apache-2.0" \
--skip-unrecognised \
"$file"
done