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