-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into script-stats
- Loading branch information
Showing
81 changed files
with
1,716 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
function comment_string () { | ||
ext=$1 | ||
if [[ $ext == "c" || $ext == "h" || $ext == "rs" ]]; then | ||
echo "//" | ||
elif [[ $ext == "nasl" || $ext == "cmake" ]]; then | ||
echo "#" | ||
fi | ||
} | ||
|
||
any_missing_headers=0 | ||
|
||
exts="c h nasl cmake" | ||
|
||
for ext in $exts; do | ||
find . -not -path "./rust/target/*" -not -path "./rust/crates/nasl-c-lib/tmp/*" -regex ".*\.\($ext\)" -print0 | while read -d $'\0' f; do | ||
header=$(head -n 3 "$f") | ||
if ! [[ "$header" =~ SPDX ]]; then | ||
echo "File does not contain license header: $f" | ||
any_missing_headers=1 | ||
|
||
if [[ "$1" == add_header ]]; then | ||
tmpfile=$(mktemp) | ||
cp "$f" "$tmpfile" | ||
comment=$(comment_string $ext) | ||
echo -e "$comment SPDX-FileCopyrightText: 2025 Greenbone AG\n$comment\n$comment SPDX-License-Identifier: GPL-2.0-or-later WITH x11vnc-openssl-exception\n" | cat - $tmpfile > "$f" | ||
fi | ||
fi | ||
done | ||
done | ||
|
||
exit $any_missing_headers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.