home · contact · privacy
Merge branch 'master' of http://github.com/plomlompom/config
[config] / bin / symlink.sh
1 #!/bin/sh
2
3 set -x
4
5 dir_minimal=~/config/dotfiles/minimal
6 dir_user_minimal=~/config/dotfiles/user/minimal
7 dir_user_thinkpad=~/config/dotfiles/user/thinkpad
8 dir_user_X200s=~/config/dotfiles/user/x200s
9 dir_user_T450s=~/config/dotfiles/user/t450s
10 dir_user_server=~/config/dotfiles/user/server
11 dir_root=~/config/dotfiles/root
12 homedir=`echo ~`
13 find ~ -lname $homedir'/config/*' -delete
14 for file in `ls $dir_minimal`; do
15     ln -fs $dir_minimal/$file ~/.$file
16 done
17 if [ "$(id -u)" -eq "0" ]; then
18     for file in `ls $dir_root`; do
19         ln -fs $dir_root/$file ~/.$file
20     done
21 else
22     for file in `ls $dir_user_minimal`; do
23         ln -fs $dir_user_minimal/$file ~/.$file
24     done
25     if [ "$1" = "thinkpad" ]; then
26         for file in `ls $dir_user_thinkpad`; do
27             ln -fs $dir_user_thinkpad/$file ~/.$file
28         done
29         if [ "$2" = "X200s" ]; then
30             for file in `ls $dir_user_X200s`; do
31                 ln -fs $dir_user_X200s/$file ~/.$file
32             done
33         else
34             for file in `ls $dir_user_T450s`; do
35                 ln -fs $dir_user_T450s/$file ~/.$file
36             done
37         fi
38     elif [ "$1" = "server" ]; then
39         for file in `ls $dir_user_server`; do
40             ln -fs $dir_user_server/$file ~/.$file
41         done
42     fi
43 fi