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="$(whoami)@$(hostname --fqdn)"
13 MY_ACCOUNT_GIT_REPO=${MY_GIT_REPOS}/accounts/${MY_ACCOUNT}.git
14 MY_GIT_URL_BASE=ssh://$MY_GIT_SERVER
15 MY_MR_REPO_URL=$MY_GIT_URL_BASE/$MY_GIT_REPOS/pub/etc/mr.git
16 MY_ACCOUNT_REPO_URL=$MY_GIT_URL_BASE/$MY_ACCOUNT_GIT_REPO
17 MR_REPO_URL=$MY_GIT_URL_BASE/~/git/pub/code/mr.git
23 if [ -z "${SSH_AUTH_SOCK:-}" ]; then
24 echo E: '$SSH_AUTH_SOCK' is not set. >&2
28 if [ ! -x "$(command -v git)" ]; then
29 echo E: git is not installed. >&2
35 if [ -e .mrconfig ]; then
36 echo E: .mrconfig already exists. >&2
40 if [ -d "$MR_FGIT" ]; then
41 echo E: "$MR_FGIT" already exists. >&2
45 if [ -d ".git" ]; then
46 echo E: .git already exists. >&2
50 if [ -d code/mr ]; then
51 if [ -x code/mr/mr ]; then
52 echo W: code/mr already exists, let us hope for the best... >&2
54 echo E: code/mr already exists. >&2
58 echo I: cloning mr into ${MR_CODE}...
59 mkdir --parent ${MR_CODE%/*}
60 git clone --no-checkout $MR_REPO_URL $MR_CODE
61 (cd $MR_CODE && git checkout -b vcsh origin/vcsh)
62 mkdir --parent $BIN_DIR
63 ln -s ../${MR_CODE}/mr $BIN_DIR/mr
67 cat <<_eof > .mrconfig
69 include = cat $MR_CODE/lib/*
72 checkout = git_fake_bare_checkout $MY_MR_REPO_URL ${MR_FGIT##*/} ../../
74 echo I: initial .mrconfig:
78 echo I: cloning mr configuration...
82 echo I: bootstrapping default .mrconfig...
83 cp $MR/templ/.mrconfig .
85 echo I: setting up base...
88 if ssh $MY_GIT_SERVER "test -d $MY_ACCOUNT_GIT_REPO" </dev/null; then
89 echo I: checking out local git repository...
90 dir="$(mktemp -d home.XXXXXXXX)"
92 git clone --no-checkout $MY_ACCOUNT_REPO_URL "$dir"/co
94 git checkout-index --quiet --index --all
100 echo I: creating remote git repository for this account...
102 GIT_DIR=${MY_ACCOUNT_GIT_REPO} git --bare init
103 echo 'account setup for $MY_ACCOUNT'
105 echo I: setting up local git repository...
107 git remote add origin $MY_ACCOUNT_REPO_URL
108 git config branch.master.remote origin
109 git config branch.master.merge refs/heads/master
111 git commit -m'initial checkin'
116 echo I: spawning a shell...
117 $SHELL -i -l </dev/tty >/dev/tty
119 echo I: back from the shell.