All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
   3 # mrsetup - set up an account using mr
 
   5 # Copyright © 2008 martin f. krafft <madduck@madduck.net>
 
   6 # Released under the terms of the Artistic Licence 2.0
 
  10 MY_GIT_SERVER=git.madduck.net
 
  12 MY_ACCOUNT_GIT_REPO=$MY_GIT_REPOS/accounts/$(whoami)@$(hostname --fqdn).git
 
  13 MY_GIT_URL_BASE=ssh://$MY_GIT_SERVER
 
  14 MY_MR_REPO_URL=$MY_GIT_URL_BASE/$MY_GIT_REPOS/pub/etc/mr.git
 
  15 MY_ACCOUNT_REPO_URL=$MY_GIT_URL_BASE/$MY_ACCOUNT_GIT_REPO
 
  16 MR_REPO_URL=git://git.kitenet.net/mr
 
  22 if [ -z "$SSH_AUTH_SOCK" ]; then
 
  23   echo E: '$SSH_AUTH_SOCK' is not set. >&2
 
  27 if [ ! -x "$(command -v git)" ]; then
 
  28   echo E: git is not installed. >&2
 
  32 if [ -e .mrconfig ]; then
 
  33   echo E: .mrconfig already exists. >&2
 
  37 if [ -d "$MR_FGIT" ]; then
 
  38   echo E: "$MR_FGIT" already exists. >&2
 
  42 if [ -d ".git" ]; then
 
  43   echo E: .git already exists. >&2
 
  47 if [ -d code/mr ]; then
 
  48   if [ -x code/mr/mr ]; then
 
  49     echo W: code/mr already exists, let us hope for the best... >&2
 
  51     echo E: code/mr already exists. >&2
 
  55   echo I: cloning mr into ${MR_CODE}...
 
  56   mkdir --parent ${MR_CODE%/*}
 
  57   git clone $MR_REPO_URL $MR_CODE
 
  59   ln -s ../${MR_CODE}/mr $BIN_DIR/mr
 
  63 cat <<_eof > .mrconfig
 
  65 include = cat $MR_CODE/lib/*
 
  68 checkout = git_fake_bare_checkout $MY_MR_REPO_URL ${MR_FGIT##*/} ../../
 
  70 echo I: initial .mrconfig:
 
  74 echo I: cloning mr configuration...
 
  78 echo I: bootstrapping default .mrconfig...
 
  79 cp $MR/templ/.mrconfig .
 
  81 echo I: setting up base...
 
  84 if ssh $MY_GIT_SERVER "test -d $MY_ACCOUNT_GIT_REPO"; then
 
  85   echo I: checking out local git repository...
 
  86   dir="$(mktemp -d home.XXXXXXXX)"
 
  88   git clone --no-checkout $MY_ACCOUNT_REPO_URL "$dir"/co
 
  90   git checkout-index --quiet --index --all
 
  94   echo I: creating remote git repository for this account...
 
  95   ssh $MY_GIT_SERVER "GIT_DIR=${MY_ACCOUNT_GIT_REPO} git --bare init"
 
  96   echo I: setting up local git repository...
 
  98   git remote add origin $MY_ACCOUNT_REPO_URL
 
  99   git config branch.master.remote origin
 
 100   git config branch.master.merge refs/heads/master
 
 102   git commit -m'initial checkin'