Continued:
[jprojects-scripts.git] / update-year-jprojects.sh
1 #!/bin/bash
2
3 # Load projects file
4 . ./.jprojects.sh || exit 255
5
6 # Loop through all projects
7 for project in ${LIST}; do
8         if [ "${project}" = "jprojects-scripts" ]
9         then
10                 echo "$0: Skipping jprojects-scripts ..."
11                 continue
12         elif [ ! -d "${JPROJECTS_HOME}/${project}" ]
13         then
14                 echo "$0: Project '${project}' does not exist."
15                 continue
16         fi
17
18         cd "${JPROJECTS_HOME}/${project}" || exit 255
19
20         echo "$0: Updating (c) year in '${project}' ..."
21         # Update both years when a new year has reached
22         find */ -type f -print0 | xargs -0 sed -i 's/2016, 2020/2016 - 2020/g'
23         find */ -type f -print0 | xargs -0 sed -i 's/2017, 2020/2017 - 2020/g'
24         find */ -type f -print0 | xargs -0 sed -i 's/2017 Free Software/2020 Free Software/g'
25         find */ -type f -print0 | xargs -0 sed -i 's/2017 Roland Häder/2020 Free Software Foundation/g'
26
27         DIFF=$(git diff)
28
29         if [ -z "${DIFF}" ]
30         then
31                 echo "$0: Nothing to commit."
32                 continue
33         fi
34
35         echo "$0: Committing ..."
36         git commit --signoff -S -a -m "Updated copyright year"
37 done
38
39 echo "$0: All done."