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=git://git.kitenet.net/mr
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
33 if [ -e .mrconfig ]; then
34 echo E: .mrconfig already exists. >&2
38 if [ -d "$MR_FGIT" ]; then
39 echo E: "$MR_FGIT" already exists. >&2
43 if [ -d ".git" ]; then
44 echo E: .git already exists. >&2
48 if [ -d code/mr ]; then
49 if [ -x code/mr/mr ]; then
50 echo W: code/mr already exists, let us hope for the best... >&2
52 echo E: code/mr already exists. >&2
56 echo I: cloning mr into ${MR_CODE}...
57 mkdir --parent ${MR_CODE%/*}
58 git clone $MR_REPO_URL $MR_CODE
60 ln -s ../${MR_CODE}/mr $BIN_DIR/mr
64 cat <<_eof > .mrconfig
66 include = cat $MR_CODE/lib/*
69 checkout = git_fake_bare_checkout $MY_MR_REPO_URL ${MR_FGIT##*/} ../../
71 echo I: initial .mrconfig:
75 echo I: cloning mr configuration...
79 echo I: bootstrapping default .mrconfig...
80 cp $MR/templ/.mrconfig .
82 echo I: setting up base...
85 if ! ssh $MY_GIT_SERVER "test -d $MY_ACCOUNT_GIT_REPO" </dev/null; then
86 echo I: checking out local git repository...
87 dir="$(mktemp -d home.XXXXXXXX)"
89 git clone --no-checkout $MY_ACCOUNT_REPO_URL "$dir"/co
91 git checkout-index --quiet --index --all
97 echo I: creating remote git repository for this account...
99 GIT_DIR=${MY_ACCOUNT_GIT_REPO} git --bare init
100 echo 'account setup for $MY_ACCOUNT'
102 echo I: setting up local git repository...
104 git remote add origin $MY_ACCOUNT_REPO_URL
105 git config branch.master.remote origin
106 git config branch.master.merge refs/heads/master
108 git commit -m'initial checkin'
113 echo I: spawning a shell...
114 $SHELL --interactive --login
116 echo I: back from the shell.