summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2014-04-12 18:17:23 +0100
committerAlan Pearce2014-04-12 18:17:23 +0100
commit65f9082920ad3d3d92929d68a125986a8c70cd0b (patch)
tree15b4be2190b44fee7a86c106efcbe11084f4a305
parent81c8016d1e296ed91af69f2d5bf435d7d657af04 (diff)
downloaddotfiles-65f9082920ad3d3d92929d68a125986a8c70cd0b.tar.lz
dotfiles-65f9082920ad3d3d92929d68a125986a8c70cd0b.tar.zst
dotfiles-65f9082920ad3d3d92929d68a125986a8c70cd0b.zip
Move install functionality to rcm hooks
-rwxr-xr-xhooks/post-up/emacs6
-rwxr-xr-xhooks/post-up/zsh34
-rwxr-xr-xinstall88
3 files changed, 40 insertions, 88 deletions
diff --git a/hooks/post-up/emacs b/hooks/post-up/emacs
new file mode 100755
index 0000000..f6071b7
--- /dev/null
+++ b/hooks/post-up/emacs
@@ -0,0 +1,6 @@
+#!/usr/bin/env zsh
+
+if [[ -s $commands[emacs] ]]
+then
+	emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/
+fi
diff --git a/hooks/post-up/zsh b/hooks/post-up/zsh
new file mode 100755
index 0000000..f964e2b
--- /dev/null
+++ b/hooks/post-up/zsh
@@ -0,0 +1,34 @@
+#!/usr/bin/env zsh
+ZDOTDIR="${XDG_CONFIG_HOME:~/.config}/zsh"
+
+if [[ ! -d ~/.zsh/cache ]]
+then
+	mkdir -p ~/.zsh/cache
+fi
+
+fasd_cache=~/.zsh/cache/fasd-init-zsh
+if [[ ! -s "$fasd_cache" || $ZDOTDIR/functions/fasd/fasd -nt "$fasd_cache" ]]; then
+	$ZDOTDIR/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache"
+fi
+
+autoload -U zrecompile
+local -a zfiles
+zfiles=(
+	$ZDOTDIR/functions/fasd/fasd
+	$fasd_cache
+	$ZDOTDIR/zshrc
+)
+
+if [[ -f $ZDOTDIR/${HOST%%.*}.zsh ]]; then
+	zfiles+=$ZDOTDIR/${HOST%%.*}.zsh
+fi
+if [[ $OSTYPE == freebsd* ]]; then
+	zfiles+=$ZDOTDIR/freebsd.zsh
+fi
+
+zrecompile -p -R $ZDOTDIR/.zshrc.zwc $zfiles -- \
+	-M .zsh/cache/compdump
+
+for fp in $ZDOTDIR/functions/*(/); do
+	zrecompile -p $fp $fp/*
+done
diff --git a/install b/install
deleted file mode 100755
index 9176902..0000000
--- a/install
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/env zsh
-
-target=~/projects/dotfiles
-pushd $HOME
-
-setopt EXTENDED_GLOB
-
-if [[ ! -d $target ]]
-then
-	mkdir -pv $target
-fi
-
-if [[ ! -d $target && ${(L)host} =~ prefect ]]
-then
-	git clone git://github.com/alanpearce/dotfiles.git $target
-fi
-
-install-dot () {
-	if [[ "$1" != . && ! -d $1 ]]
-	then
-		mkdir $1
-	fi
-
-	for f in $@[2,-1]
-	do
-		if [[ ! -e $1$f:t ]]
-		then
-			ln -sf $f $1$f:t
-		fi
-	done
-}
-
-install-dot $target/.git/hooks/ $target/git-hooks/*
-install-dot .emacs.d/ $target/emacs/{init.el{,c},elisp}
-install-dot . $target/^install(.) $target/zsh/fasdrc
-install-dot .ssh/ $target/ssh/*
-if [[ -d ~/Library/LaunchAgents ]]
-then
-	install-dot ~/Library/LaunchAgents $target/launchagents/*
-fi
-
-ln -sf $target/zsh/environment.zsh .zshenv
-ln -sf $target/zsh/interactive.zsh .zshrc
-ln -sf $target/zsh/login.zsh .zlogin
-ln -sf $target/zsh/logout.zsh .zlogout
-
-if [[ -d projects/dwm ]]
-then
-	install-dot projects/dwm/ $target/dwm/*
-fi
-
-if [[ -s $commands[emacs] ]]
-then
-	emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/
-fi
-
-if [[ ! -d ~/.zsh/cache ]]
-then
-	mkdir -p ~/.zsh/cache
-fi
-
-fasd_cache=~/.zsh/cache/fasd-init-zsh
-if [[ ! -s "$fasd_cache" || $target/zsh/functions/fasd -nt "$fasd_cache" ]]; then
-	$target/zsh/functions/fasd/fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >! "$fasd_cache"
-fi
-
-autoload -U zrecompile
-local -a zfiles
-zfiles=(
-	$target/zsh/functions/fasd/fasd
-	$fasd_cache
-	$target/zsh/interactive.zsh
-)
-if [[ -f $target/zsh/${HOST%%.*}.zsh ]]; then
-	zfiles+=$target/zsh/${HOST%%.*}.zsh
-fi
-if [[ $OSTYPE == freebsd* ]]; then
-	zfiles+=$target/zsh/freebsd.zsh
-fi
-
-zrecompile -p -R ~/.zshrc.zwc $zfiles -- \
-	-M .zsh/cache/compdump
-
-for fp in $target/zsh/functions/*(/); do
-	zrecompile -p $fp $fp/*
-done
-
-popd