-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·133 lines (120 loc) · 4.26 KB
/
bootstrap.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Initialize variables
echo ""
echo " >> Sourcing path variables"
source ./config/.exports
# Install Oh My ZSH
oh_my_zsh() {
echo ""
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
# sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo ""
}
# Install Powerlevel9k
# Currently archived. Leaving this here for vis, but switching to Powerlevel10k
powerlevel9k() {
echo ""
git clone https://github.com/bhilburn/powerlevel9k.git $HOME/.oh-my-zsh/custom/themes/powerlevel9k
echo ""
}
# Install Powerlevel10k
powerlevel10k() {
echo ""
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
echo ""
}
# Create initial directories
directories () {
echo " >> Checking to make sure the $PATH_TO_PROJECTS directory exists"
if [ ! -d "$PATH_TO_PROJECTS" ] ; then
echo " >> Making directory $PATH_TO_PROJECTS"
mkdir -p "$PATH_TO_PROJECTS"
else
echo " >> Directory already exists"
fi
}
# TODO : Delete symlinks to deleted files
# Is this where rsync shines?
# TODO - add support for -f and --force
link_home() {
echo " >> Linking dotfiles from this repo to the home directory"
read -p " >> Proceed? (y/n) : " resp
if [ "$resp" = 'y' -o "$resp" = 'Y' ] ; then
echo ""
for file in $( ls -A ./$LOC_HOME_FILES/ | grep -vE '\.exclude*|\.ex*|\.git$|\.gitignore|.*.md' ) ; do
if [ -f $HOME/$file ] ; then
read -p " >> $file already exists, overwrite? (y/n) : " resp
if [ "$resp" = 'y' -o "$resp" = 'Y' ] ; then
rm "$HOME/$file"
ln -sfv "$PWD/$LOC_HOME_FILES/$file" "$HOME"
echo ""
else
echo " >> Did not overwrite $file"
fi
else
ln -sv "$PWD/$LOC_HOME_FILES/$file" "$HOME"
fi
done
echo " >> Symlinking to home directory complete"
else
echo ""
echo " >> Symlinking to home directory cancelled by user"
return -1
fi
}
# SUmmary post-install information
summary() {
echo " >> Configuration complete"
echo " >> The script did not check to ensure Powerline fonts are installed."
echo " >> Visit https://github.com/powerline/fonts for install information."
echo " >> If using Powerlevel10k, visit https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k for more info."
echo ""
echo " >> If on a Linux system, you can run the command below to install Powerline fonts: "
echo ""
echo " sudo apt install powerline fonts-powerline"
echo ""
echo " >> If on a macOS system, you can install the correct fonts by visiting the site: "
echo ""
echo " https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k"
echo ""
}
echo ""
echo "Oh My ZSH Installation"
echo "-----------------------------------------------------------------------------------"
if [ ! -d "$HOME/.oh-my-zsh/" ] ; then
echo " >> Oh My ZSH is not installed at $HOME/.oh-my-zsh"
read -p " >> Would you like to install Oh My ZSH? (y/n) : " resp
if [ "$resp" = 'y' -o "$resp" = 'Y' ] ; then
oh_my_zsh
fi
else
echo " >> Oh Oh My ZSH is installed at $HOME/.oh-my-zsh."
echo " >> Skipping install."
fi
echo ""
echo "Powerlevel10k Theme"
echo "-----------------------------------------------------------------------------------"
if [ ! -d "$HOME/.oh-my-zsh/custom/themes/powerlevel10k/" ] ; then
echo " >> The Powerlevel10k theme is not installed with Oh My ZSH. You may have it installed elsewhere (not checked)."
echo " >> The default configuration of this repo requires the Powerlevel10k theme."
read -p " >> Would you like to install the Powerlevel10k theme for Oh My ZSH? (y/n) : " resp
if [ "$resp" = 'y' -o "$resp" = 'Y' ] ; then
powerlevel10k
else
echo " >> Skipping the Powerlevel10k installation."
fi
else
echo " >> The Powerlevel10k theme is already installed for Oh My ZSH."
echo " >> Skipping install."
fi
echo ""
echo "Checking Directory Structure"
echo "-----------------------------------------------------------------------------------"
directories
echo ""
echo "Symbolinc Linking to Home Directory"
echo "-----------------------------------------------------------------------------------"
link_home
echo ""
echo "Post Bootstrap Summary"
echo "-----------------------------------------------------------------------------------"
summary