MaxScale/script/update-license-url
2021-01-18 15:30:30 +02:00

57 lines
1.1 KiB
Bash
Executable File

#!/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: 2025-01-18
#
# 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 "update-license-url from to"
echo
echo " from: Old license, e.g. www.mariadb.com/bsl"
echo " to : New license, e.g. www.mariadb.com/bsl11"
echo
echo "For instance: update-license-url www.mariadb.com/bsl www.mariadb.com/bsl11"
exit 1
}
function run
{
local from=$1
local to=$2
#local files=`find . -type f`
local files=`git ls-files`
for f in $files
do
fgrep -q "$from" $f 2> /dev/null
if [ $? -eq 0 ]
then
echo $f
sed -i -e "s@$from@$to@" $f
fi
done
}
function main
{
if [ $# -ne 2 ]
then
print_usage_and_exit
fi
run $1 $2
}
main $*