Jepp, no more these projects
[jprojects-scripts.git] / push-stick.sh
1 #!/bin/bash
2
3 . ./.jprojects.sh || exit 255
4
5 TARGETS="o d t u"
6
7 if [ "$1" = "a" ]
8 then
9         cd "${JPROJECTS_HOME}"
10         for TARGET in ${TARGETS}; do
11                 echo "$0: Pushing for target '${TARGET}' ..."
12                 $0 "${TARGET}" "$2"
13         done
14
15         echo "$0: Pushed to all targets."
16         exit 0
17 fi
18
19 for project in ${LIST}; do
20         if [ ! -d "${JPROJECTS_HOME}/${project}" ]
21         then
22                 echo "$0: Project '${project}' does not exist."
23                 continue;
24         fi
25
26         echo "$0: Processing '${project}',mode='$1' ..."
27         cd "${JPROJECTS_HOME}/${project}" || exit 255
28
29         if [ "$1" = "d" ]
30         then
31                 if [ -n "$2" ]
32                 then
33                         git push daedalus :"$2"
34                 fi
35
36                 git push --all daedalus || exit 255
37         elif [ "$1" = "t" ]
38         then
39                 if [ -n "$2" ]
40                 then
41                         git push transport :"$2"
42                 fi
43
44                 git push --all transport || exit 255
45         elif [ "$1" = "u" ]
46         then
47                 if [ -n "$2" ]
48                 then
49                         git push upstream :"$2"
50                 fi
51
52                 git push --all upstream || exit 255
53         else
54                 if [ -n "$2" ]
55                 then
56                         git push origin :"$2"
57                 fi
58
59                 git push --all || exit 255
60         fi
61 done
62
63 echo "$0: All done."
64 exit 0