-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·60 lines (41 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
#! /bin/bash
set -euxo 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
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"
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
# ------------------------------------------------------------------------------
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"