summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@oxygen.local>2011-08-23 23:46:15 +0200
committerTobias Klauser <tklauser@oxygen.local>2011-08-23 23:46:15 +0200
commitddf1e8baadfcc23bc420961aee1ddea8f5228b43 (patch)
tree39a4e0a12e4832a91ace022686054d762a61b4cb
Initial commit
-rwxr-xr-xmrmovein82
1 files changed, 82 insertions, 0 deletions
diff --git a/mrmovein b/mrmovein
new file mode 100755
index 0000000..1a456ab
--- /dev/null
+++ b/mrmovein
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# move in script - set up a newly created account with sensible configuration
+#
+# Copyright 2011 Tobias Klauser <tklauser@distanz.ch>
+# Released under the terms of the Artistic Licence 2.0
+#
+# Based on mrsetup by martin f. krafft which is:
+# Copyright 2008 martin f. krafft <madduck@madduck.net>
+#
+
+set -eu
+
+GIT_SERVER=ssh://git.distanz.ch
+GIT_REPOS='srv/git/git.distanz.ch'
+MR_CODE=$HOME/src/mr
+MR_REPO_URL=$GIT_SERVER/$GIT_REPOS/mr.git
+MR_DOTFILES_REPO_URL=$GIT_SERVER/$GIT_REPOS/dotfiles/mr.git
+DOTFILES=$HOME/src/dotfiles
+MR_DOTFILES=src/dotfiles/mr.git
+
+if [ ! -x "$(command -v git)" ]; then
+ echo "E: git is not installed." >&2
+ exit 2
+fi
+
+cd $HOME
+
+if [ -e .mrconfig ]; then
+ echo "E: .mrconfig already exists." >&2
+ exit 2
+fi
+
+if [ -d "$DOTFILES" ]; then
+ echo "E: $DOTFILES already exists." >&2
+ exit 3
+fi
+
+if [ -d .git ]; then
+ echo "E: .git already exists." >&2
+ exit 4
+fi
+
+if [ -d $MR_CODE ]; then
+ if [ -x $MR_CODE/mr ]; then
+ echo "W: $MR_CODE already exists, let's hope for the best." >&2
+ else
+ echo "E: $MR_CODE already exists but doesn't provide mr." >&2
+ exit 5
+ fi
+else
+ echo "I: cloning mr into $MR_CODE..."
+ mkdir -p ${MR_CODE%/*}
+ git clone --no-checkout $MR_REPO_URL $MR_CODE
+ (cd $MR_CODE && git checkout -b vcsh origin/vcsh)
+ echo
+fi
+
+cat << EOF > .mrconfig.movein
+[DEFAULT]
+include = cat $MR_CODE/lib/*
+
+[$MR_DOTFILES]
+checkout = git_fake_bare_checkout $MR_DOTFILES_REPO_URL ${MR_DOTFILES##*/} ../../../
+EOF
+
+cat << EOF > .mrtrust
+.mrconfig.movein
+EOF
+
+echo "I: initial .mrconfig:"
+cat .mrconfig.movein
+echo
+
+echo "I: cloning mr configuration..."
+$MR_CODE/mr --config .mrconfig.movein co
+echo
+
+#echo "I: setting up base..."
+#$MR_CODE/mr co
+
+exit 0