From 17643e842e4d3c909b86fcf8e68f965932a47720 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 25 Jun 2019 09:23:29 +0300 Subject: [PATCH] Add script for checking Change Date Check that if a file has a Change Date entry that the date is the expected one. --- script/check-change-date | 54 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 script/check-change-date diff --git a/script/check-change-date b/script/check-change-date new file mode 100755 index 000000000..95e95212b --- /dev/null +++ b/script/check-change-date @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Copyright (c) 2016 MariaDB Corporation Ab +# +# Use of this software is governed by the Business Source License included +# in the LICENSE.TXT file and at www.mariadb.com/bsl11. +# +# Change Date: 2023-01-01 +# +# On the date above, in accordance with the Business Source License, use +# of this software will be governed by version 2 or later of the General +# Public License. +# + +function print_usage_and_exit +{ + echo "check-change-date date" + echo + echo " date: The expected change date, e.g. 2023-01-01" + + exit 1 +} + +function run +{ + local date=$1 + + local files=`find . -type f` + + for f in $files + do + fgrep -q "Change Date:" $f 2> /dev/null + if [ $? -eq 0 ] + then + fgrep -q "Change Date: $date" $f 2> /dev/null + if [ $? -ne 0 ] + then + echo "$f lacks expected Change Date." + fi + fi + done +} + +function main +{ + if [ $# -ne 1 ] + then + print_usage_and_exit + fi + + run $1 +} + +main $*