fixed this
[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                 cp -vu "${JPROJECTS_HOME}/jprojects-scripts/.gitignore" "${JPROJECTS_HOME}/${project}"
16         fi
17
18         if [ -d "${JPROJECTS_HOME}/${project}" -a ! -d "${JPROJECTS_HOME}/${project}/docs" -o "$1" = "f" ]
19         then
20                 echo "$0: GNU-ifying project '${project}' ..."
21                 mkdir --parent "${JPROJECTS_HOME}/${project}/docs" || exit 255
22                 cp -rpv ${JPROJECTS_HOME}/jprojects-scripts/docs/* "${JPROJECTS_HOME}/${project}/docs/" || exit 255
23                 cp -vu "${JPROJECTS_HOME}/jprojects-scripts/.gitignore" "${JPROJECTS_HOME}/${project}"
24                 cp -vu "${JPROJECTS_HOME}/jprojects-scripts/.gitattributes" "${JPROJECTS_HOME}/${project}"
25                 cd "${JPROJECTS_HOME}/${project}"
26                 echo "$0: git add ..."
27                 git add docs || exit 255
28                 echo "$0: git rm ..."
29                 git rm -f COPYING
30                 echo "$0: git mv ..."
31                 git mv docs/COPYING . || exit 255
32                 cd "${JPROJECTS_HOME}"
33         else
34                 echo "$0: Project '${project}' already prepared."
35         fi
36 done
37
38 echo "$0: All done."
39 exit 0