From: Roland Häder Date: Wed, 15 Jan 2020 15:11:07 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?p=jprojects-scripts.git;a=commitdiff_plain;h=dfc38bb2e77e6184f2cf895ad2ed7e694e17a42e Continued: - added script to update copyright year Signed-off-by: Roland Häder --- diff --git a/update-year-jprojects.sh b/update-year-jprojects.sh new file mode 100755 index 0000000..e43cf52 --- /dev/null +++ b/update-year-jprojects.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Load projects file +. ./.jprojects.sh || exit 255 + +# Loop through all projects +for project in ${LIST}; do + if [ "${project}" = "jprojects-scripts" ] + then + echo "$0: Skipping jprojects-scripts ..." + continue + elif [ ! -d "${JPROJECTS_HOME}/${project}" ] + then + echo "$0: Project '${project}' does not exist." + continue + fi + + cd "${JPROJECTS_HOME}/${project}" || exit 255 + + echo "$0: Updating (c) year in '${project}' ..." + # Update both years when a new year has reached + find */ -type f -print0 | xargs -0 sed -i 's/2016, 2020/2016 - 2020/g' + find */ -type f -print0 | xargs -0 sed -i 's/2017, 2020/2017 - 2020/g' + find */ -type f -print0 | xargs -0 sed -i 's/2017 Free Software/2020 Free Software/g' + find */ -type f -print0 | xargs -0 sed -i 's/2017 Roland Häder/2020 Free Software Foundation/g' + + DIFF=$(git diff) + + if [ -z "${DIFF}" ] + then + echo "$0: Nothing to commit." + continue + fi + + echo "$0: Committing ..." + git commit --signoff -S -a -m "Updated copyright year" +done + +echo "$0: All done."