Mercurial > hg > anonet-resdb
comparison scripts/update-git-remotes @ 389:3531789e64ef draft
Add a very basic script which creates a git remote for each resdb user
who has registered a git url.
author | Anonymous Coward <nobody@nowhere> |
---|---|
date | Wed, 02 Feb 2011 16:21:07 +0000 |
parents | |
children | 2f57d4d36759 |
comparison
equal
deleted
inserted
replaced
388:468578335816 | 389:3531789e64ef |
---|---|
1 #!/bin/sh | |
2 # | |
3 # Creates git remotes from the user db | |
4 # TODO: detect users' git address changes | |
5 # | |
6 | |
7 if ! ./scripts/check_db_safety; then | |
8 exit 1 | |
9 fi | |
10 | |
11 USR_DB_DIR=./db/usr | |
12 GIT_REPO=./.git | |
13 GIT_REMOTES_DIR=$GIT_REPO/refs/remotes | |
14 | |
15 for u in `ls -1 $USR_DB_DIR`; do | |
16 git_url_file="$USR_DB_DIR/$u/git" | |
17 | |
18 if [ -f $git_url_file ]; then | |
19 git_url=`cat $git_url_file` | |
20 git_remote_name="anonet_$u" | |
21 | |
22 if [ -d $GIT_REMOTES_DIR/$git_remote_name ]; then | |
23 # The remote already exists; | |
24 # TODO: Update it if it has changed. | |
25 echo "skipping $u" >&2 | |
26 | |
27 else | |
28 git remote add -t master -m master $git_remote_name $git_url | |
29 | |
30 fi | |
31 | |
32 fi | |
33 done |