forked from ciyam/ciyam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_copyright_year
executable file
·34 lines (27 loc) · 1.5 KB
/
update_copyright_year
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
#!/bin/sh
# Copyright (c) 2013-2022 CIYAM Developers
#
# Distributed under the MIT/X11 software license, please refer to the file license.txt
# in the root project directory or http://www.opensource.org/licenses/mit-license.php.
#
# Task #T00004 - Update copyright dates to 2013
# NOTE: Replace with an explicit year leave this empty to derive the year from 'date'.
DATEYEAR=""
if [ ! "$1" = "-skip_check" ]; then
cat .git/config | grep github.com:ciyam/ciyam.git 2>&1 > /dev/null
GITCHECK=$?
if [ "$GITCHECK" != "0" ]; then
echo "Error: The current directory isn't the CIYAM git repo root directory!"
exit 1
fi
fi
if [ "$DATEYEAR" == "" ]; then
DATEYEAR=`date +%Y`
fi
git ls-files | grep -Ev "\.gz$|\.jpg$|\.png$" | xargs -I{} sed -i "s/Copyright \([0-9]\{4\}\) CIYAM Developers/Copyright (c) \1-${DATEYEAR} CIYAM Developers/" "{}"
git ls-files | grep -Ev "\.gz$|\.jpg$|\.png$" | xargs -I{} sed -i "s/Copyright (c) \([0-9]\{4\}\) CIYAM Developers/Copyright (c) \1-${DATEYEAR} CIYAM Developers/" "{}"
git ls-files | grep -Ev "\.gz$|\.jpg$|\.png$" | xargs -I{} sed -i "s/Copyright \([0-9]\{4\}\)-\([0-9]\{4\}\) CIYAM Developers/Copyright (c) \1-${DATEYEAR} CIYAM Developers/" "{}"
git ls-files | grep -Ev "\.gz$|\.jpg$|\.png$" | xargs -I{} sed -i "s/Copyright (c) \([0-9]\{4\}\)-\([0-9]\{4\}\) CIYAM Developers/Copyright (c) \1-${DATEYEAR} CIYAM Developers/" "{}"
echo
echo "NOTE: Also need to manually update 'footer.htms' files for generated applications as well as re-generate all HTML documentation files."
exit 0