-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·204 lines (154 loc) · 5.29 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/usr/bin/env bash
RED="$(tput setaf 1)"
YELLOW="$(tput setaf 3)"
NORMAL="$(tput sgr0)"
CYAN="$(tput setaf 6)"
command_exists() {
type "$1" > /dev/null 2>&1
}
echo "Recognize OS"
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
...
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
...
else
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
OS=$(uname -s)
VER=$(uname -r)
fi
echo $OS
echo "Installing dotfiles"
echo "Initializing submodule(s)"
if [ "$OS" == "Ubuntu Linux" ]; then
sudo apt update && apt install -y git
fi
git submodule update --init --recursive
source install/link.sh
# only perform macOS-specific install
if [ "$OS" == "Darwin" ]; then
echo -e "\n\nRunning on OSX"
source install/git.sh
source install/brew.sh
source install/osx.sh
# create a backup of the original nginx.conf
if [ -f /usr/local/etc/nginx/nginx.conf ]; then
mv /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf.original
fi
ln -s ~/.dotfiles/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf
# symlink the code.dev from dotfiles
ln -s ~/.dotfiles/nginx/code.dev /usr/local/etc/nginx/sites-enabled/code.dev
# install neovim
source install/nvim.sh
# install tmux
source install/tmux.sh
# install node version manager
source install/nvm.sh
elif [ "$OS" == "Manjaro Linux" ]; then
echo -e "\n\nRunning on Linux (Arch)"
source install/pacman.sh
# turn on network time protocol
sudo timedatectl set-ntp true
source install/git.sh
if [ -d ~/.tmux/plugins/tpm ]; then
# printf "${YELLOW}You already have Tmux Plugin Manager installed.${NORMAL}\n"
cd ~/.tmux/plugins/tpm
git fetch
git pull
cd -
else
git clone git://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
mkdir -p ~/.local/share/fonts/
cp ~/.dotfiles/resources/fonts/Hasklig/* ~/.local/share/fonts/
cp ~/.dotfiles/resources/fonts/FiraCode/otf/* ~/.local/share/fonts/
# install fonts
source install/fonts.sh
# cp ~/.dotfiles/resources/fonts/NerdFonts/FiraCode/OTF/* ~/.local/share/fonts/
# cp ~/.dotfiles/resources/fonts/NerdFonts/Hasklig/* ~/.local/share/fonts/
# pillow is needed to render images in kitty terminal
sudo pip install -U pillow
# symlink i3 config file
if [ ! -d ~/.i3 ]; then
mkdir ~/.i3
fi
if [ ! -f ~/.i3/config.bak && -f ~/.i3/config ]; then
mv ~/.i3/config ~/.i3/config.bak
if [ ! -f ~/.i3/config ]; then
ln -s ~/.dotfiles/config/i3/config ~/.i3/config
fi
fi
elif [ "$OS" == "Ubuntu Linux" ]; then
echo -e "\n\nRunning on Linux (Debian)"
source install/apt.sh
source install/git.sh
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
rm -rf ~/.fzf
cp ~/.dotfiles/resources/fonts/Hasklig/* ~/.local/share/fonts/
cp ~/.dotfiles/resources/fonts/FiraCode/otf/* ~/.local/share/fonts/
cp ~/.dotfiles/resources/fonts/NerdFonts/FiraCode/OTF/* ~/.local/share/fonts/
# cp ~/.dotfiles/resources/fonts/NerdFonts/Hasklig/* ~/.local/share/fonts/
# make the left alt key behave like the right one
setxkbmap -option lv3:lalt_switch
# set keyboard delay and repeat rate
gsettings set org.gnome.desktop.peripherals.keyboard repeat-interval 30
gsettings set org.gnome.desktop.peripherals.keyboard delay 250
# install kitty
source install/kitty.sh
# add pillow to system so the kitty image preview works
pip install pillow
# install i3-gaps
source install/i3-gaps.sh
# install polybar
source install/polybar.sh
# install rofi
source install/rofi.sh
# install neovim
source install/nvim.sh
# install tmux
source install/tmux.sh
# install node version manager
source install/nvm.sh
fi
source install/composer.sh
echo -e "\n\n${GREEN}Creating vim directories."
echo "==============================${NORMAL}"
mkdir -p ~/.vim-tmp
if ! command_exists zsh; then
echo "zsh not found. Please install and then re-run installation scripts"
exit 1
elif ! [[ $SHELL =~ .*zsh.* ]]; then
echo "Configuring zsh as default shell"
chsh -s $(which zsh)
fi
source install/omz.sh
echo -e "\n\n${GREEN}Done. Restart your Terminal."
echo "==============================${NORMAL}"
# if [ "$(uname)" == "Darwin" ]; then
# toilet -f future -F border ' Remember to install the vim pligins ! ' -t && toilet -f smmono9 ' ~/$ vim +PlugInstall' -t
# else
printf "${RED}Remember to install the plugins!${NORMAL}\n"
printf "${GREEN} --> vim: ${NORMAL} ${CYAN}vim +PlugInstall!${NORMAL}\n"
printf "${GREEN} --> tmux: ${NORMAL} run ${CYAN}prefix + I${NORMAL} inside a tmux session\n"
# fi
echo -e "\n"