-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·58 lines (47 loc) · 1.24 KB
/
setup.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
#!/bin/zsh
user() {
printf "\r\033[00;34m[ .. ] »\033[0m $1\n"
}
info() {
printf "\r\033[0;33m[ ?? ] »\033[0m $1\n"
}
success() {
printf "\r\033[00;32m[ !! ] »\033[0m $1\n"
}
link() {
rm -f "$2"
ln -s "$1" "$2"
}
begin() {
# Symlink all the things
user "Symlinking dotfiles."
for file in .[^.]*; do
[[ $file =~ (.git|.DS_Store)$ ]] && continue
link "`pwd`/$file" "$HOME/$file"
done
info "Dotfiles symlinked."
# user "Symlinking functions directory"
# link "`pwd`/.functions/" "$HOME/.functions"
# Do the OSX thing
# user "Loading OSX preferences. You will need to enter your password."
# zsh ./.osx
# info "OSX preferences loaded. Note that some of these changes require a logout/restart to take effect."
success "Everything worked!"
# Reload ZSH
user "Reloading ZSH..."
exec zsh;
}
# Optionally force
if [ "$1" == "--force" -o "$1" == "-f" ]; then
begin;
else
info "This script will symlink everything from this directory to your home directory."
info "These dotfiles may overwrite existing ones in your home directory."
read -p "Are you absolutely sure you want to continue? (Yn)" -n 1;
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "";
user "Sounds good. Let's go!"
begin;
fi;
fi;
unset begin;