diff options
| author | vutral <vutral@vutral.ano> | 2011-02-03 08:58:44 +0100 | 
|---|---|---|
| committer | vutral <vutral@vutral.ano> | 2011-02-03 08:58:44 +0100 | 
| commit | 503c1603d591817d8d02d66f5dfdf5132bb42fd3 (patch) | |
| tree | dbb0eb3889f845f5f02b4f418dc6a1bc213990b7 /scripts/update-git-remotes | |
| parent | e540c8edbfccbfa3201f1387c0864de94f4384ff (diff) | |
| parent | 3266eb68b87721a5dca7b54cabc1e866b48828a8 (diff) | |
| download | resdb-503c1603d591817d8d02d66f5dfdf5132bb42fd3.tar.gz resdb-503c1603d591817d8d02d66f5dfdf5132bb42fd3.zip | |
Merge branch 'master' of git://1.0.27.102
Diffstat (limited to 'scripts/update-git-remotes')
| -rw-r--r-- | scripts/update-git-remotes | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/scripts/update-git-remotes b/scripts/update-git-remotes new file mode 100644 index 0000000..8048d54 --- /dev/null +++ b/scripts/update-git-remotes @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Creates git remotes from the user db +# TODO: detect users' git address changes +# + +if ! ./scripts/check_db_safety; then + exit 1 +fi + +USR_DB_DIR=./db/usr +GIT_REPO=./.git +GIT_REMOTES_DIR=$GIT_REPO/refs/remotes + +for u in `ls -1 $USR_DB_DIR`; do +  git_url_file="$USR_DB_DIR/$u/git" + +  if [ -f $git_url_file ]; then +    git_url=`cat $git_url_file` +    git_remote_name="anonet_$u" + +    if [ -d $GIT_REMOTES_DIR/$git_remote_name ]; then +      # The remote already exists; +      # TODO: Update it if it has changed. +      echo "skipping $u" >&2 + +    else +      git remote add -t master -m master $git_remote_name $git_url + +    fi + +  fi +done | 
