]> git.mxchange.org Git - jprojects-scripts.git/blob - update-year-jprojects.sh
b17436439adaade054345d65bd3935b4e4d3d1cf
[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/2020, 2022/2020 - 2023/g'
23         find */ -type f -print0 | xargs -0 sed -i 's/2022 Free Software/2023 Free Software/g'
24
25         DIFF=$(git diff)
26
27         if [ -z "${DIFF}" ]
28         then
29                 echo "$0: Nothing to commit."
30                 continue
31         fi
32
33         echo "$0: Committing ..."
34         git commit --signoff -S -a -m "Updated copyright year"
35 done
36
37 echo "$0: All done."