summary refs log tree commit diff stats
path: root/install
diff options
context:
space:
mode:
authorAlan Pearce2013-04-28 20:54:18 +0100
committerAlan Pearce2013-04-28 20:54:18 +0100
commite7657d6ba54ad5714657cff9be86ec416d342a4c (patch)
tree50a2fada14e8d5f76ef890c4b860fbdd4faf812f /install
parent6bec14c2d18c915a3510aba36a37e78a8b83170f (diff)
downloaddotfiles-e7657d6ba54ad5714657cff9be86ec416d342a4c.tar.lz
dotfiles-e7657d6ba54ad5714657cff9be86ec416d342a4c.tar.zst
dotfiles-e7657d6ba54ad5714657cff9be86ec416d342a4c.zip
Migrate repository from mercurial without history
Diffstat (limited to 'install')
-rwxr-xr-xinstall44
1 files changed, 44 insertions, 0 deletions
diff --git a/install b/install
new file mode 100755
index 0000000..80dc299
--- /dev/null
+++ b/install
@@ -0,0 +1,44 @@
+#!/usr/bin/env zsh
+
+pushd $HOME
+
+setopt EXTENDED_GLOB
+
+if [[ ! -d dotfiles && ${(L)host} =~ prefect ]]
+then
+	hg clone ssh://alan@home.alanpearce.co.uk:22222/dotfiles
+fi
+
+install-dot () {
+	local absolute
+	if [[ ${1[-1]} == "/" ]]
+	then
+		absolute=$PWD/
+
+		if [[ ! -d $1 ]]
+		then
+			mkdir $1
+		fi
+
+	else
+		absolute=""
+	fi
+
+	for f in $@[2,-1]
+	do
+		if [[ ! -e $1$f:t ]]
+		then
+			ln -sf $absolute$f $1$f:t
+		fi
+	done
+}
+
+install-dot .emacs.d/ dotfiles/emacs/*
+install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc
+install-dot .ssh/ dotfiles/ssh/*
+if [[ -d dwm ]]
+then
+	install-dot dwm/ dotfiles/dwm/*
+fi
+
+popd