forked from dgvncsz0f/dot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·75 lines (63 loc) · 1.5 KB
/
install.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
73
74
75
#!/bin/sh
ln_bin=/bin/ln
env_bin=/usr/bin/env
git_bin=${GIT_BIN:-$(which git)}
print_info()
{
printf "%s\n" "$1"
}
print_error()
{
printf "ERROR - %s\n" "$1"
exit 1
}
check_binaries()
{
if [ ! -x "$git_bin" ]
then
print_error "git binary not found"
fi
if [ ! -x "$ln_bin" ]
then
print_error "ln binary not found"
fi
if [ ! -x "$env_bin" ]
then
print_error "env binary not found"
fi
}
dot_clone_dot()
{
print_info "CLONING DOT INTO $HOME/.dotfiles"
if [ -d "$HOME/.dotfiles" ]
then
(cd "$HOME/.dotfiles" && $git_bin pull)
else
$git_bin clone --recursive https://github.com/lorn/dotfiles.git "$HOME/.dotfiles"
fi
}
dot_clone_zsh()
{
print_info "CLONING OH-MY-ZSH INTO $HOME/.oh-my-zsh"
if [ -d "$HOME/.oh-my-zsh" ]
then
(cd "$HOME/.oh-my-zsh" && $git_bin pull)
else
$git_bin clone https://github.com/ohmyzsh/ohmyzsh.git "$HOME/.oh-my-zsh"
fi
}
dot_install_dot()
{
print_info "INSTALLING DOT FILES"
$ln_bin -s -f -n "$HOME/.dotfiles/dot.gitconfig" "$HOME/.gitconfig"
$ln_bin -s -f -n "$HOME/.dotfiles/Brewfile" "$HOME/.Brewfile"
$ln_bin -s -f -n "$HOME/.dotfiles/dot.config" "$HOME/.config"
$ln_bin -s -f -n "$HOME/.dotfiles/dot.scripts" "$HOME/.scripts"
$ln_bin -s -f -n "$HOME/.dotfiles/dot.zshrc" "$HOME/.zshrc"
$ln_bin -s -f -n "$HOME/.dotfiles/dot.oh-my-custom.zsh" "$HOME/.oh-my-zsh/custom/custom-lorn.zsh"
$ln_bin -s -f -n "$HOME/.dotfiles/dot.p10k.zsh" "$HOME/.p10k.zsh"
}
check_binaries
dot_clone_dot
dot_clone_zsh
dot_install_dot