-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlink.sh
executable file
·72 lines (72 loc) · 1.43 KB
/
link.sh
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
#!/bin/sh
. zsh/os.zsh
tmp=`pwd`
cd
escape() {
echo "[$1m$2[0m"
}
err() {
escape 31 "E: $1"
}
info () {
escape 33 "I: $1"
}
msg() {
escape 32 "$1"
}
link() {
if [ -e $2 -a ! -L $2 ]; then
err "$2 is not a symlink"
elif [ -L $2 ]; then
target=`readlink $2`
if [ $target = $tmp/$1 ]; then
info "$2 is already linked"
else
err "$2 is linked, but points at wrong target"
fi
else
ln -s $tmp/$1 $2
msg "linked $2"
fi
}
md() {
if [ -d $1 ]; then
info "directory $1 already exists"
elif [ -f $1 ]; then
err "file $1 exists, but is not a directory"
else
mkdir -p $1
msg "created directory $1"
fi
}
link zsh .zsh
link zsh/zshrc .zshrc
link zsh/zshenv .zshenv
link zsh/profile.zsh .profile
link screenrc .screenrc
link tmux.conf .tmux.conf
link ghci .ghci
link bin bin
link git/gitconfig .gitconfig
if [ ! -e $HOME/.gitconfig.local ]; then
cp $tmp/git/gitconfig.local .gitconfig.local
msg "a template was copied to $HOME/.gitconfig.local, please edit this file"
fi
link vim/vimrc .vimrc
link vim .vim
link emacs/emacs .emacs
link xmonad .xmonad
link x11/Xresources .Xresources
if linux || freebsd; then
link x11/Xmodmap .Xmodmap
link x11/xinitrc .xinitrc
link z/z.sh .zsh/z.sh
md local
link color local/color
link xpdfrc .xpdfrc
elif darwin; then
link x11-osx/Xdefaults .Xdefaults
link x11-osx/xinitrc .xinitrc
fi
link mailcap .mailcap
link ideavim/ideavimrc .ideavimrc