summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnonymous Coward <nobody@nowhere>2011-02-02 16:21:07 +0000
committerAnonymous Coward <nobody@nowhere>2011-02-02 16:22:17 +0000
commit93ebf26f9a32da2caa15f6951425b03e04d1936a (patch)
tree470c5f6f153a19ebfa1f647ce3957b5f128b2cad
parent777b9cb05ef6978f0497d14af98017aaf0c209c1 (diff)
downloadresdb-93ebf26f9a32da2caa15f6951425b03e04d1936a.tar.gz
resdb-93ebf26f9a32da2caa15f6951425b03e04d1936a.zip
Add a very basic script which creates a git remote for each resdb user
who has registered a git url.
-rw-r--r--scripts/update-git-remotes33
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