forked from julienbourdeau/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymlink-dotfiles.sh
executable file
·72 lines (59 loc) · 1.64 KB
/
symlink-dotfiles.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/bash
dotfiles="$HOME/Projects/dotfiles"
if [[ -d "$dotfiles" ]]; then
echo "Symlinking dotfiles from $dotfiles"
else
echo "$dotfiles does not exist"
exit 1
fi
link() {
from="$1"
to="$2"
echo "Linking '$from' to '$to'"
rm -f "$to"
ln -s "$from" "$to"
}
sulink() {
from="$1"
to="$2"
echo "Linking '$from' to '$to'"
sudo rm -f "$to"
sudo ln -s "$from" "$to"
}
# Link `bin/` directory
# It's a `.bin` because I don't like seeing it
link "$dotfiles/bin" "$HOME/.bin"
# Link dotfiles
for location in $(find home -name '*.sh'); do
file="${location##*/}"
file="${file%.sh}"
link "$dotfiles/$location" "$HOME/.$file"
done
# # Link apache conf
# if [[ `uname` == 'Darwin' ]]; then
# echo "Linking Apache config"
# # httpd.conf
# sudo rm "/usr/local/etc/apache2/2.4/httpd.conf.bk"
# sudo mv "/usr/local/etc/apache2/2.4/httpd.conf" "/usr/local/etc/apache2/2.4/httpd.conf.bk"
# sulink "$dotfiles/etc/apache2/httpd.conf" "/usr/local/etc/apache2/2.4/httpd.conf"
# # extra/ folder
# for location in $(find etc/apache2/extra -name '*.conf'); do
# file="${location##*/}"
# file="${file}"
# sulink "$dotfiles/$location" "/usr/local/etc/apache2/2.4/extra/$file"
# done
# mkdir "/usr/local/etc/apache2/2.4/users/"
# # users/ folder
# for location in $(find etc/apache2/users -name '*.conf'); do
# file="${location##*/}"
# file="${file}"
# sulink "$dotfiles/$location" "/usr/local/etc/apache2/2.4/users/$file"
# done
# fi
# sudo apachectl -k restart
# Vim config
link "$dotfiles/vim" "$HOME/.vim"
touch "$HOME/.vimlocal"
# Host file
sudo rm -f /etc/hosts
sulink "$dotfiles/etc/hosts" "/etc/hosts"