-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcpconf
More file actions
executable file
·249 lines (238 loc) · 6.06 KB
/
Copy pathcpconf
File metadata and controls
executable file
·249 lines (238 loc) · 6.06 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
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#!/bin/bash
cd $(dirname $(readlink -f "$0") )
capps=()
cthemes=()
ffamilies=""
gtkbookm=""
localonly=""
nerdin=""
nvimin=""
p10kc=""
picomc=""
profsrc=""
psed=""
qgset=""
terml=""
tmuxc=""
viml="/etc/vimrc"
vscopy=""
xcont=""
xprofin=""
zshc="/etc/zsh/zshrc"
zshs=""
setenv () {
if [ "$localonly" != "" ]; then
echo "export $1" >> "$HOME/.profile"
else
echo "$1" | sudo tee -a /etc/environment >/dev/null
fi
}
zshcadd () {
if [ "$localonly" != "" ]; then
tee $1 "$HOME/.zshrc" >/dev/null
else
sudo tee $1 "$zshc" >/dev/null
fi
}
while [ "$1" != "" ]; do
case "$1" in
-c) # add folder to copy to .config
capps+=("$2")
shift
;;
-cc) # copy vscode config according to the vscode version
vscopy="$2"
shift
;;
-ct) # add theme to copy
cthemes+=("$2")
shift
;;
-f) # set custom name for fontconfig families file
ffamilies="$2"
shift
;;
-gb) # use the set gtk bookmarks
gtkbookm="yes"
;;
-l) # preferably install config files locally
localonly="yes"
;;
-n) # use neovim instead of vim
nvimin="yes"
;;
-ni) # install nerd font symbols
nerdin="yes"
;;
-p) # use p10k in zsh
p10kc="yes"
;;
-pc) # copy picom config
picomc="yes"
;;
-pi) # install p10k
p10kc="install"
;;
-pr) # source .profile in .zprofile (to be used if it doesn't get sourced already)
profsrc="yes"
;;
-ps) # sed on polkit nopasswd file
psed="$2"
shift
;;
-qg) # set gtk2 qt style
qgset="QT_QPA_PLATFORMTHEME=gtk2"
;;
-qk) # set kvantum qt style
qgset="QT_STYLE_OVERRIDE=kvantum"
;;
-t) # set TERMINAL
terml="$2"
shift
;;
-tc) # tmux copy config
tmuxc="yes"
;;
-v) # location of vimrc
viml="$2"
shift
;;
-xc) # copy game controller udev rule
xcont="yes"
;;
-xp) # copy xprofile file
xprofin="#"
;;
-xs) # sed on xprofile
xprofin="$2"
shift
;;
-z) # location of zshrc (full path + filename 'zshrc')
zshc="$2"
shift
;;
-zs) # sed on zshrc
zshs="$2"
shift
;;
esac
shift
done
sudo usermod -a -G video $(whoami)
sudo usermod -s /bin/zsh $(whoami)
sudo usermod -s /bin/zsh root
mkdir "$HOME/.config"
mkdir "$HOME/.themes"
if [ "$nerdin" != "" ]; then
sudo wget --directory-prefix /usr/local/share/fonts "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v3.3.0/patched-fonts/NerdFontsSymbolsOnly/SymbolsNerdFont-Regular.ttf"
sudo wget --directory-prefix /usr/local/share/fontconfig/conf.avail "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v3.3.0/10-nerd-font-symbols.conf"
fi
if [ "$p10kc" = "install" ]; then
sudo git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /usr/share/zsh-theme-powerlevel10k
fi
if [ "$p10kc" != "" ]; then
cp p10k.zsh ~/.p10k.zsh
echo '
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi' | zshcadd
fi
sed "$zshs" zshrc | zshcadd -a
touch ~/.zshrc
if [ "$p10kc" != "" ]; then
zshcadd -a <<'EOL'
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
EOL
fi
echo 'export GOPATH=~/.local/share/go' >> ~/.profile
if [ "$qgset" != "" ]; then
setenv "$qgset"
fi
if [ "$terml" != "" ]; then
setenv "TERMINAL=$terml"
fi
if [ "$profsrc" != "" ]; then
echo 'source ~/.profile' >> ~/.zprofile
fi
git config --global user.name "Popa Ioan Alexandru"
git config --global user.email "alexioanpopa11@gmail.com"
git config --global init.defaultBranch main
if [ "$localonly" != "" ]; then
install -Dm644 vimrc "$HOME/.vimrc"
mkdir "$HOME/.fonts"
cp -r iosevka-custom "$HOME/.fonts"
install -Dm644 50-families.conf "$HOME/.config/fontconfig/conf.d/$ffamilies"
else
cat vimrc | sudo tee -a "$viml" >/dev/null
sudo cp -r iosevka-custom /usr/share/fonts
sudo install -Dm644 50-families.conf "/etc/fonts/conf.d/$ffamilies"
fi
sudo install -Dm644 00-keyboard.conf /etc/X11/xorg.conf.d/00-keyboard.conf
sudo install -Dm644 30-touchpad.conf /etc/X11/xorg.conf.d/30-touchpad.conf
sudo install -Dm644 10-unqualified-search-registries.conf /etc/containers/registries.conf.d/10-unqualified-search-registries.conf
if [ "$gtkbookm" != "" ]; then
install -Dm644 "gtk-3.0/bookmarks" "$HOME/.config/gtk-3.0/bookmarks"
fi
if [ "$xcont" != "" ]; then
sudo cp 51-xbox-gamepad.rules /etc/udev/rules.d/
fi
sudo mkdir -p /etc/polkit-1/rules.d/
if [ "$psed" != "" ]; then
sed "$psed" 49-nopasswd_global.rules | sudo tee /etc/polkit-1/rules.d/49-nopasswd_global.rules >/dev/null
else
sudo cp 49-nopasswd_global.rules /etc/polkit-1/rules.d/
fi
if [ "$nvimin" != "" ]; then
if [ "$localonly" != "" ]; then
mkdir -p ~/.config/nvim/
echo "source $HOME/.vimrc" > ~/.config/nvim/init.vim
else
sudo mkdir -p /etc/xdg/nvim/
echo "source $viml" | sudo tee -a /etc/xdg/nvim/sysinit.vim >/dev/null
fi
echo "alias vim='nvim'" | zshcadd -a
setenv "EDITOR=nvim"
else
setenv "EDITOR=vim"
fi
if [ "$picomc" != "" ]; then
if [ "$localonly" != "" ]; then
install -Dm644 picom.conf "$HOME/.config/picom.conf"
else
sudo install -Dm644 picom.conf /etc/xdg/picom.conf
fi
fi
if [ "$tmuxc" != "" ]; then
if [ "$localonly" != "" ]; then
install -Dm644 tmux.conf "$HOME/.config/tmux/tmux.conf"
else
sudo install -Dm644 tmux.conf /etc/tmux.conf
fi
fi
if [ "$xprofin" != "" ]; then
if [ "$localonly" != "" ]; then
sed "$xprofin" xprofile > "$HOME/.xprofile"
chmod +x "$HOME/.xprofile"
else
sed "$xprofin" xprofile | sudo tee /etc/xprofile >/dev/null
sudo chmod +x /etc/xprofile
fi
fi
if [ "$vscopy" != "" ]; then
cp -r Code "$HOME/.config/$vscopy"
fi
for capp in "${capps[@]}"; do
cp -r "$capp" "$HOME/.config"
done
for ctheme in "${cthemes[@]}"; do
if [ "$localonly" != "" ]; then
cp -r "$ctheme" "$HOME/.themes"
else
sudo cp -r "$ctheme" "/usr/share/themes"
fi
done