summaryrefslogtreecommitdiffstats
path: root/update-all.sh
blob: 8d64fb93bf7f113c180b07641947dac97a1f1fe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh


wget -q http://tcosproject.org/git/ -O- > tmp

ALL_PACKAGES=$(grep DIR tmp | awk -F "href=\"" '{print $2}'| awk -F"/\"" '{print $1}'|grep ".git")
rm -f tmp

ARGS=""

case "$1" in
  status)
     MODE=status
     ;;
  gc)
     MODE=gc
     ;;
  push)
     MODE=push
     ;;
  *)
     MODE=pull
     #ARGS=" --rebase"
     ;;
esac

for pkg in $ALL_PACKAGES; do

  dir=$(basename $pkg .git)

  #rm -rf $dir

  if [ ! -d $dir ]; then
    git clone git@tcosproject.org:$pkg
  else
    echo " *** MODE='$MODE': ****  package '$pkg'"
    if [ "$MODE" = "status" ]; then
      #( cd $dir && git status | grep -q "nothing to commit (working directory clean)" || git status)
      ( cd $dir && git status | grep -q -e "Your branch is ahead" -e "Changed but" && git status)
    elif [ "$MODE" = "push" ]; then
      ( cd $dir && git push && git push --tags)
      grep -q github $dir/.git/config && ( cd $dir && git push github && git push github --tags)
    else
      (cd $dir && git $MODE $ARGS)
    fi
  fi

done