Improvements
[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 to '${project}' ..."
13                 cp -v dist.sh "${JPROJECTS_HOME}/${project}/" || exit 255
14         fi
15
16         if [ -d "${JPROJECTS_HOME}/${project}" -a ! -d "${JPROJECTS_HOME}/${project}/docs" -o "$1" = "f" ]
17         then
18                 echo "$0: GNU-ifying project '${project}' ..."
19                 mkdir --parent "${JPROJECTS_HOME}/${project}/docs" || exit 255
20                 cp -rpv docs/* "${JPROJECTS_HOME}/${project}/docs/" || exit 255
21                 cd "${JPROJECTS_HOME}/${project}"
22                 echo "$0: git add ..."
23                 git add docs || exit 255
24                 echo "$0: git rm ..."
25                 git rm -f COPYING
26                 echo "$0: git mv ..."
27                 git mv docs/COPYING . || exit 255
28                 cd "${JPROJECTS_HOME}"
29         else
30                 echo "$0: Project '${project}' already prepared."
31         fi
32 done
33
34 echo "$0: All done."
35 exit 0