ocf/.github/verify_header.sh
Kamil Lepek 3464bb5da7 Fix permissions for verify_header.sh
Signed-off-by: Kamil Lepek <kamil.lepek@intel.com>
2022-05-05 13:49:05 +02:00

25 lines
577 B
Bash
Executable File

#!/bin/bash
#
# Copyright(c) 2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
YEAR=$(date +"%Y")
REGEX="Copyright\(c\) [0-9]{4}-([0-9]{4}) |Copyright\(c\) ([0-9]{4}) "
while read -r line; do
if [[ "$line" =~ $REGEX ]]; then
echo ${BASH_REMATCH[0]}
if [[ $YEAR == ${BASH_REMATCH[1]} || $YEAR == ${BASH_REMATCH[2]} ]]; then
echo $1 have appropriate license header
exit 0
fi
echo $1 have wrong license header year
exit 1
fi
done < "$1"
echo $1 does not contain appropriate license header
exit 1