-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·210 lines (180 loc) · 4.82 KB
/
install
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
#!/bin/bash
# Script for installation and configuration user environment.
# Prerequisities (fedora package names):
# ===============
# git, zsh, freetype-freeworld, levien-inconsolata-fonts
#
DIRNAME=$(dirname $0)
REPO_PATH=$(cd $DIRNAME && pwd)/
FONT_PATH="$REPO_PATH/fonts/"
dotfile_prefix="$HOME/."
scripts_prefix="$HOME/bin/"
MODULES=(
"base16-shell:modules/base16-shell"
"tpm:tmux/plugins/tpm"
# "nvchad/:config/nvim" -- disabled
)
#config files with omited ~/. prefix
CONFIGS=(config/tmux/tmux.conf
vimrc
gvimrc
profile
env
functions
aliases
kubectl_aliases
h.sh
config/tilda/config_0
config/gtk-3.0/settings.ini
config/gtk-4.0/settings.ini
config/mc_solarized.ini
config/redshift.conf
gtkrc-2.0
config/i3/config
config/i3/conkyrc
config/dunst/dunstrc
config/awesome/rc.lua
config/awesome/themes/default/theme.lua
config/autorandr/postswitch
config/picom/picom.conf
tern-config
gitconfig
gitattributes
tigrc
Xresources
gitignore_global
ctags
antigen.zsh
zshrc
zshenv
zsh-completion
# config/nvim/lua/custom
yabairc
skhdrc
aerospace.toml
config/borders/bordersrc
config/kitty/kitty.conf
config/starship.toml
)
SCRIPTS=(tmux-default
i3exit
brightness
battery
pactl-default-sink
i3status.sh
xkbmap-layout.sh
nm-i3.sh
monitor-select.sh
kubectl-all
docked.sh
rofi-pulse-sink.sh
rofi-pulse-source.sh
rm-older-than.sh
kubeconfig-merge.sh
rancher-get-kubeconfig.sh
rancher-get-all-configs.sh
aws-profile.sh
aws-role.sh
argocd-review-sync.sh
aerospace-reposition-windows.sh
aerospace-remove-ghost-windows.sh
)
function backup {
for file in "${CONFIGS[@]}"
do
if [ -e "$dotfile_prefix$file" ]
then
cp "$dotfile_prefix$file" "$dotfile_prefix${file}.bck"
fi
done
for module in "${MODULES[@]}"; do
IFS=':' read -r -a split_module <<< "$module"
destination_dir="$dotfile_prefix${split_module[1]}"
if [ -e "$destination_dir" ] && [ ! -L "$destination_dir" ]; then
mv $destination_dir "${destination_dir}.bck"
fi
mkdir -p "$(dirname "$destination_dir")"
ln -s "${REPO_PATH}modules/${split_module[0]}" "$destination_dir"
done
for file in "${SCRIPTS[@]}"
do
if [ -e "$scripts_prefix$file" ]
then
cp "$scripts_prefix$file" "$dotfile_prefix${file}.bck"
fi
done
}
function create_links {
for file in "${CONFIGS[@]}"
do
#Create config file directory
if [ "." != $(dirname $file) ]
then
mkdir -p $dotfile_prefix$(dirname $file)
fi
if [ -e "$dotfile_prefix$file" ]
then
rm -rf "$dotfile_prefix$file"
fi
ln -s "$REPO_PATH$file" "$dotfile_prefix$file"
done
for module in "${MODULES[@]}"; do
IFS=':' read -r -a split_module <<< "$module"
destination_dir="$dotfile_prefix${split_module[1]}"
if [ -L "$destination_dir" ]; then
continue # skip if already is a link
fi
mkdir -p "$(dirname "$destination_dir")"
ln -s "${REPO_PATH}modules/${split_module[0]}" "$destination_dir"
done
for file in "${SCRIPTS[@]}"
do
if [ ! -d $scripts_prefix ] ; then
mkdir -p $scripts_prefix ;
fi
# remove script if exists
if [ -e "$scripts_prefix$file" ] ; then
rm -rf "$scripts_prefix$file"
fi
ln -s "$REPO_PATH/scripts/$file" "$scripts_prefix$file"
done
########## Copy fonts
if [ ! -d $HOME/.fonts ] ; then
mkdir $HOME/.fonts
fi
cp $FONT_PATH/$font/* "$HOME/.fonts/"
}
function print_usage {
echo "./install [opts]"
echo " -b backup configs"
echo " -l links - use links as configs"
}
if [ $# -lt 1 ]
then
echo "No parameters specified. Usage:"
print_usage
fi
while getopts "lbi" opt; do
case $opt in
i)
echo "Installing needed packages and configuring environment"
install
;;
# t) echo "Installing gnome-terminal colorschemes"
# install_gt_colorschemes
# ;;
# u)
# echo "Update configuration by copying configuration files"
# copy
# ;;
b) echo "Creating backup of config files"
backup
;;
l) echo "Replacing config files with links to the repository"
create_links
;;
\?)
print_usage
;;
esac
done