Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 15 Jan 2020 15:11:07 +0000 (16:11 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 15 Jan 2020 15:11:07 +0000 (16:11 +0100)
- added script to update copyright year

Signed-off-by: Roland Häder <roland@mxchange.org>
update-year-jprojects.sh [new file with mode: 0755]

diff --git a/update-year-jprojects.sh b/update-year-jprojects.sh
new file mode 100755 (executable)
index 0000000..e43cf52
--- /dev/null
@@ -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."