#!/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