view scripts/update-git-remotes @ 612:b721aa91808d draft

/A1/lex2> somerandomnick: BTW you can remove my clientport from a2.o if you so desire /A1/lex2> I would update it in my repository but really there is no point in me doing so because you won't pull from me over IPv6 :v /SVC/srnbot> IPv6 sucks.
author Nick <nick@somerandomnick.ano>
date Fri, 16 Sep 2011 10:02:19 +0000
parents 3531789e64ef
children 2f57d4d36759
line wrap: on
line source

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