home · contact · privacy
Don't symlink user dotfiles into root home.
[config] / 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_server=~/config/dotfiles_user_server
9 dir_root=~/config/dotfiles_root
10 homedir=`echo ~`
11 find ~ -lname $homedir'/config/*' -delete
12 for file in `ls $dir_minimal`; do
13     ln -fs $dir_minimal/$file ~/.$file
14 done
15 if [ "$(id -u)" -eq "0" ]; then
16     for file in `ls $dir_root`; do
17         ln -fs $dir_root/$file ~/.$file
18     done
19 else
20     for file in `ls $dir_user_minimal`; do
21         ln -fs $dir_user_minimal/$file ~/.$file
22     done
23     if [ "$1" = "thinkpad" ]; then
24         for file in `ls $dir_user_thinkpad`; do
25             ln -fs $dir_user_thinkpad/$file ~/.$file
26         done
27     elif [ "$1" = "server" ]; then
28         for file in `ls $dir_user_server`; do
29             ln -fs $dir_user_server/$file ~/.$file
30         done
31     fi
32 fi