-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·213 lines (159 loc) · 5.5 KB
/
setup.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
205
206
207
208
209
210
211
# make config dir fn
mkconfig () {
if [[ ! -d ~/.config ]]; then
mkdir -p ~/.config
fi
}
write_git_config () {
echo "Installing git configuration..."
cp ./gitconfig ~/.gitconfig
cp ./gitignore_global ~/.gitignore_global
}
# Save pwd.
# TODO this assumes that the script is running from the setup_anywhere dir
SCRIPTDIR=`pwd`
# Simple argparse, don't need to be fancy
if [[ $1 == "all" ]]; then
args=( "awesome" "nvim" "git" "powerline" "kitty" "dwm" "conky" "dunst" "iosevka" "other" )
else
args=( "$@" )
fi
for arg in ${args[@]}; do
case $arg in
awesome)
mkconfig
if [[ ! -d ~/.config/awesome ]]; then
echo "Cloning AwesomeWM dotfiles..."
git clone https://github.com/warnespe001/awesome-dotfiles ~/.config/awesome > /dev/null
else
echo "Updating AwesomeWM dotfiles..."
fi
cd ~/.config/awesome
git checkout custom-config &> /dev/null
git pull > /dev/null
cd - > /dev/null
;;
iosevka|Iosevka)
sudo cp -r Iosevka_dist/* /usr/share/fonts/truetype/
;;
nvim|neovim)
mkconfig
if [[ ! -d ~/.config/nvim ]]; then
echo "Cloning neovim configuration..."
git clone https://github.com/warnespe001/neovim-config ~/.config/nvim > /dev/null
else
echo "Updating neovim configuration..."
fi
cd ~/.config/nvim
git submodule update --init > /dev/null
git pull > /dev/null
echo "Installing neovim plugins..."
nvim --headless +PluginInstall +qall &> /dev/null
cd - > /dev/null
;;
git)
if [[ ! -e ~/.gitconfig ]]; then
write_git_config
else
read -p "Overwrite existing gitconfig? [y/N] " -n 1 -r
if [[ $REPLY == "y" ]]; then
write_git_config
else
echo "Refusing to overwrite gitconfig."
fi
fi
;;
powerline-shell|powerline|pl)
mkconfig
cd /tmp
git clone https://github.com/warnespe001/powerline-shell > /dev/null
cd /tmp/powerline-shell
git checkout feature/truecolor
git pull
# setup script requires sudo. This should initiate an askpass.
sudo python3 setup.py install
if [[ ! -d ~/.config/powerline-shell/themes ]]; then
mkdir -p ~/.config/powerline-shell/themes
fi
cd $SCRIPTDIR
cp ./powerline-config.json ~/.config/powerline-shell/config.json
cp ./powerline-dracula.py ~/.config/powerline-shell/themes/dracula.py
# Append powerline prompt command to bashrc
# This obviously assumes the host system uses bash (which I pretty much always do)
grep "_update_ps1" ~/.bashrc > /dev/null
if [[ $? != 0 ]]; then
cat ./powerline-blob >> ~/.bashrc
fi
;;
kitty)
mkconfig
if [[ ! -d ~/.config/kitty ]]; then
mkdir -p ~/.config/kitty
fi
cp ./kitty/*.conf ~/.config/kitty/
;;
dwm)
echo "Clone dwm repo into home directory? (dfl: /tmp) [y/N] "
read -n1 ans
if [[ "$ans" == "y" || "$ans" == "Y" ]]; then
cd ~
else
cd /tmp
fi
git clone https://github.com/warnespe001/dwm.git > /dev/null
cd dwm
git pull > /dev/null
make
# Installation requires privs. This should initiate an askpass.
sudo make install
cd $SCRIPTDIR
;;
conky)
mkconfig
cd ~/.config
if [[ -d ~/.config/conky ]]; then
echo "~/.config/conky already exists; overwrite? [y/N] "
read -n1 ans
if [[ "$ans" != "y" && "$ans" != "Y" ]]; then
echo "Refusing to overwrite existing conky configuration."
continue
fi
fi
rm -r ~/.config/conky > /dev/null
git clone https://github.com/warnespe001/conky_config.git conky
cd conky
git pull
cd $SCRIPTDIR
;;
dunst)
mkconfig
cd ~/.config
if [[ -d ~/.config/dunst ]]; then
echo "~/.config/dunst already exists; overwrite? [y/N] "
read -n1 ans
if [[ "$ans" != "y" && "$ans" != "Y" ]]; then
echo "Refusing to overwrite existing dunst configuration."
continue
fi
fi
rm -r ~/.config/dunst > /dev/null
git clone https://github.com/warnespe001/dunst_config.git dunst
cd dunst
git pull
cd $SCRIPTDIR
;;
other)
echo "Installing various other configurations..."
mkconfig
if [[ ! -d ~/.dotfiles ]]; then
git clone https://github.com/Jeremie1001/dotfiles ~/.dotfiles > /dev/null
fi
cd ~/.dotfiles/.config
cp -r dmenu picom rofi sddm xmenu ~/.config
cd - > /dev/null
;;
*)
echo "Unknown option $arg"
;;
esac
done