summary refs log tree commit diff stats
path: root/install
blob: 8d6ae180c7199c338a5bb56a72de64f15c16bd60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/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 dotfiles/.git/hooks/ dotfiles/git-hooks/*
install-dot .emacs.d/ dotfiles/emacs/*
install-dot . dotfiles/^install(.) dotfiles/zsh/zshrc
install-dot .ssh/ dotfiles/ssh/*
if [[ -d projects/dwm ]]
then
	install-dot projects/dwm/ dotfiles/dwm/*
fi

if [[ -x =emacs ]]
then
	emacs --batch --eval '(batch-byte-recompile-directory 0)' ~/.emacs.d/
fi

fasd_cache=~/.zsh/cache/fasd-init-zsh
if [[ ! -s "$fasd_cache" || zsh/functions/fasd -nt "$fasd_cache" ]]; then
	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=(
	zsh/functions/fasd/fasd
	$fasd_cache
	zsh/zshrc
	zsh/zshrc_${HOST%%.*}
)
if [[ -e /usr/bin/emerge ]]; then
	zfiles+=zsh/zshrc_gentoo
fi
if [[ $OSTYPE == freebsd* ]]; then
	zfiles+=zsh/zshrc_freebsd
fi

zrecompile -p -R ~/.zshrc.zwc $zfiles

for fp in zsh/functions/*(/); do
	zrecompile -p $fp $fp/*
done

popd