-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·69 lines (49 loc) · 2.02 KB
/
install.sh
File metadata and controls
executable file
·69 lines (49 loc) · 2.02 KB
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
#!/bin/bash
set -euo pipefail
ORIGINAL_COLOR="\033[1;0m"
GREEN="\033[0;32m"
GRAY="\033[2m"
RED="\033[31m"
title() {
echo -e "\n${GREEN}${1}...${ORIGINAL_COLOR}\n"
}
# ------------------------------------------------------------------------------
title "Creating backup & creating symlinks to new dotfiles"
cd ~/.dotfiles/files
for file in *; do
[ "$file" = "~" ] && continue
echo -ne "~/.$file ${GRAY}"
if [ -s ~/.$file ]; then
if ! diff -q ~/.$file ~/.dotfiles/files/$file &>/dev/null; then
mv ~/.$file ~/.$file.bkp
ln -s ~/.dotfiles/files/$file ~/.$file
echo -ne "has been moved to ~/.$file.bkp and a new symlink has been created ${GREEN}✓${ORIGINAL_COLOR}\n"
else
echo -ne "is identical ${RED}✕${ORIGINAL_COLOR}"
fi
else # File doesn't exist, let's create it:
ln -s ~/.dotfiles/files/$file ~/.$file
echo -ne "symlink has been created ${GREEN}✓${ORIGINAL_COLOR}"
fi
echo -e "${ORIGINAL_COLOR}"
done
# ------------------------------------------------------------------------------
title "Installing ZSH plugins"
ZSH_PLUGINS=(
"https://github.com/zsh-users/zsh-syntax-highlighting.git plugins/zsh-syntax-highlighting"
"https://github.com/zsh-users/zsh-autosuggestions.git plugins/zsh-autosuggestions"
"https://github.com/romkatv/powerlevel10k.git themes/powerlevel10k"
)
for plugin in "${ZSH_PLUGINS[@]}"; do
repo="${plugin% *}"
dest="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/${plugin#* }"
[ -d "$dest" ] || git clone "$repo" "$dest"
done
# ------------------------------------------------------------------------------
title "Setting up macOS configs"
if [[ "$OSTYPE" == "darwin"* ]]; then ~/.dotfiles/other_files/macOS; fi
# ------------------------------------------------------------------------------
title "Installing Homebrew packages and applications"
if [[ "$OSTYPE" == "darwin"* ]]; then brew bundle --file=~/.dotfiles/other_files/Brewfile; fi
# ------------------------------------------------------------------------------
echo -e "\n${GREEN}Done!${ORIGINAL_COLOR}\n"