-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·64 lines (51 loc) · 1.95 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
#!/bin/sh
log_success() {
fg="\033[0;32m"
reset="\033[0m"
echo "${fg}$1${reset}"
}
log_info() {
fg="\033[0;34m"
reset="\033[0m"
echo "${fg}$1${reset}"
}
log_warn() {
fg="\033[0;33m"
reset="\033[0m"
echo "${fg}$1${reset}"
}
log_error() {
fg="\033[0;31m"
reset="\033[0m"
echo "${fg}$1${reset}"
}
set -e
if [ "$(uname -o)" = "GNU/Linux" ]; then
log_info "Upgrading current dependencies and distribution ..."
sudo apt update -y && sudo apt dist-upgrade -y
log_info "Installing useful dependencies (git, curl, jq, vim, etc.) ..."
sudo apt install -y autojump bash-completion ca-certificates curl file git gnupg jq keychain make man rsync tree uidmap unzip vim wget zsh
log_info "Auto uninstalling unnecessary dependencies ..."
sudo apt autoremove -y
fi
log_info "Updating or cloning dotfiles project ..."
mkdir -p "$HOME/.ssh"
if [ -d "$HOME/.dotfiles" ]; then
(
cd "$HOME/.dotfiles"
([ "$(git status --porcelain | wc -l)" -eq 0 ] && git pull) || log_warn "Changes detected in $HOME/.dotfiles, not pulling project ..."
)
log_info "Updating oh-my-zsh plugins ..."
git submodule update --recursive --remote
elif [ -n "$HTTP_CLONE" ] || [ "$(find "$HOME/.ssh" -maxdepth 1 ! -name '*.*' -name 'id_*' | wc -l)" -eq 0 ]; then
git clone --recurse-submodules https://github.com/kilianpaquier/dotfiles.git "$HOME/.dotfiles"
else
git clone --recurse-submodules [email protected]:kilianpaquier/dotfiles.git "$HOME/.dotfiles"
fi
log_info "Updating or cloning pure prompt ..."
mkdir -p "$HOME/.zsh"
([ -d "$HOME/.zsh/pure" ] && cd "$HOME/.zsh/pure" && git pull) || git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
log_info "Installing oh-my-zsh ..."
[ -d "$HOME/.oh-my-zsh" ] || sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
log_info "Setting up .zshrc symbolic link ..."
ln -sf "$HOME/.dotfiles/.zshrc" "$HOME/.zshrc"