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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#! /bin/sh
#
# updatecopyright - updates copyright in files
#
# Copyright (C) 2005 - 2025 Eggheads Development Team
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Brackets as a cheap way to not find self
PATTERN="copyright.*eggheads developmen[t]"
find_copyright_files() {
grep -lri -- "$PATTERN" *
}
update_copyright() {
LINE=`grep -i -- "$PATTERN" $1`
# Format 1
grep -Ei 'copyright.*[0-9]{4} ?- ?[0-9]{4}.*eggheads' $i 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo "Format 1"
sed -e 's/\(copyright[^\n0-9]*[0-9][0-9][0-9][0-9] *- *\)[0-9][0-9][0-9][0-9]\( eggheads\)/\1'"$YEAR"'\2/ig' $i > ${i}_
chmod --reference=$i ${i}_
mv ${i}_ $i
fi
# Format 2
grep -Ei 'copyright[^-]*[0-9]{4}[^-]*eggheads' $i 2>&1 >/dev/null
if [ $? -eq 0 ]; then
echo "Format 2"
sed -e 's/\(copyright[^\s0-9-]*[0-9][0-9][0-9][0-9]\)\( eggheads\)/\1 - '"$YEAR"'\2/ig' $i > ${i}_
chmod --reference=$i ${i}_
mv ${i}_ $i
fi
# Cats and Dogs
sed -i '/Eggdrop v" EGG_STRINGVER " (C) 1997 Robey Pointer (C) 1999-/c\ "Eggdrop v" EGG_STRINGVER " (C) 1997 Robey Pointer (C) 1999-'$YEAR' Eggheads Development Team",' src/main.c
sed -i '/Eggdrop v" EGG_STRINGVER "+" EGG_PATCH " (C) 1997 Robey Pointer (C) 1999-/c\ "Eggdrop v" EGG_STRINGVER "+" EGG_PATCH " (C) 1997 Robey Pointer (C) 1999-'$YEAR' Eggheads Development Team",' src/main.c
}
if test ! -f src/main.c; then
echo "You are not in the Eggdrop root directory."
exit 1
fi
if test "x$1" = "x"; then
echo "Usage: $0 <year>"
exit 1
fi
YEAR=$1
if test $YEAR -lt 2015 -o $YEAR -gt 2030; then
echo "Invalid year. Usage: $0 <year>"
exit 1
fi
count=0
echo "Updating documentation copyright..."
sed -i "s/^copyright = .*/copyright = u'$YEAR, Eggheads'/" doc/sphinx_source/conf.py
sed -i "s/^copyright = .*/copyright = u'$YEAR, Eggheads'/" doc/sphinx_source/firstinstall/conf.py
## ./misc/generatedocs
for i in $(find_copyright_files); do
count=$(($count + 1))
echo "${i}... "
update_copyright $i $YEAR
echo "done."
done
git diff | egrep "^(\+|-) "
echo "Found/fixed ${count} files."
|