#!/usr/bin/env zsh target=~/projects/dotfiles pushd $HOME setopt EXTENDED_GLOB if [[ ! -d $target && ${(L)host} =~ prefect ]] then git clone ssh://alan@home.alanpearce.co.uk:22222/~/dotfiles.git fi install-dot () { 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/zshrc $target/zsh/fasdrc install-dot .ssh/ $target/ssh/* if [[ -d projects/dwm ]] then install-dot projects/dwm/ $target/dwm/* fi if [[ -x =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/zshrc ) if [[ -f $target/zsh/zshrc_${HOST%%.*} ]]; then zfiles+=$target/zsh/zshrc_${HOST%%.*} fi if [[ -e /usr/bin/emerge ]]; then zfiles+=$target/zsh/zshrc_gentoo fi if [[ $OSTYPE == freebsd* ]]; then zfiles+=$target/zsh/zshrc_freebsd fi zrecompile -p -R ~/.zshrc.zwc $zfiles for fp in $target/zsh/functions/*(/); do zrecompile -p $fp $fp/* done popd