Skipped missing projects
[jprojects-scripts.git] / cp-dist.sh
1 #!/bin/bash
2
3 . ./.jprojects.sh || exit 255
4
5 for project in ${LIST}; do
6         if [ "${project}" = "jprojects-scripts" ]
7         then
8                 echo "$0: Skipping jprojects-scripts ..."
9                 continue
10         elif [ -f "${JPROJECTS_HOME}/${project}/dist.sh" ]
11         then
12                 echo "$0: Copying dist.sh/.git* to '${project}' ..."
13                 cp -v dist.sh "${JPROJECTS_HOME}/${project}/" || exit 255
14                 cp -vu "${JPROJECTS_HOME}/jprojects-scripts/.gitattributes" "${JPROJECTS_HOME}/${project}"
15         fi
16
17         if [ -d "${JPROJECTS_HOME}/${project}" -a ! -d "${JPROJECTS_HOME}/${project}/docs" -o "$1" = "f" ]
18         then
19                 echo "$0: GNU-ifying project '${project}' ..."
20                 mkdir --parent "${JPROJECTS_HOME}/${project}/docs" || exit 255
21                 cp -rpv ${JPROJECTS_HOME}/jprojects-scripts/docs/* "${JPROJECTS_HOME}/${project}/docs/" || exit 255
22                 cp -vu "${JPROJECTS_HOME}/jprojects-scripts/.gitignore" "${JPROJECTS_HOME}/${project}"
23                 cp -vu "${JPROJECTS_HOME}/jprojects-scripts/.gitattributes" "${JPROJECTS_HOME}/${project}"
24                 cd "${JPROJECTS_HOME}/${project}"
25                 echo "$0: git add ..."
26                 git add docs || exit 255
27                 echo "$0: git rm ..."
28                 git rm -f COPYING
29                 echo "$0: git mv ..."
30                 git mv docs/COPYING . || exit 255
31                 cd "${JPROJECTS_HOME}"
32         else
33                 echo "$0: Project '${project}' already prepared."
34         fi
35 done
36
37 echo "$0: All done."
38 exit 0