-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·192 lines (173 loc) · 4.34 KB
/
install.sh
File metadata and controls
executable file
·192 lines (173 loc) · 4.34 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
#!/bin/sh +x
export CONFIG_DIR=$HOME/.config
export DOTFILES_DIR=$HOME/dotfiles
export CONFIG_DOTFILES_DIR=$DOTFILES_DIR/config
remove_file_if_exists() {
local file="$1"
echo "removing $file ..."
if [ -e "$file" ]; then
rm -rf "$file"
echo " removed $file successfully"
fi
}
create_dir_if_doesnt_exists() {
local dir="$1"
if [ -d "$dir" ]; then
echo "The directory $dir already exists"
else
mkdir -p "$dir"
echo "The directory $dir was created successfully"
fi
}
config_files=(
# Neovim
$CONFIG_DOTFILES_DIR/nvim/lua
$CONFIG_DOTFILES_DIR/nvim/init.lua
# Tut
$CONFIG_DOTFILES_DIR/tut/themes
$CONFIG_DOTFILES_DIR/tut/accounts.toml
$CONFIG_DOTFILES_DIR/tut/config.toml
# Iamb
$CONFIG_DOTFILES_DIR/iamb/config.toml
# Kitty
$CONFIG_DOTFILES_DIR/kitty/kitty.conf
# Newsboat
$CONFIG_DOTFILES_DIR/newsboat/urls
$CONFIG_DOTFILES_DIR/newsboat/config
# Sway
$CONFIG_DOTFILES_DIR/sway/config
$CONFIG_DOTFILES_DIR/sway/wp.png
# Waybar
$CONFIG_DOTFILES_DIR/waybar/config.jsonc
$CONFIG_DOTFILES_DIR/waybar/mediaplayer.py
$CONFIG_DOTFILES_DIR/waybar/style.css
# Wofi
$CONFIG_DOTFILES_DIR/wofi/config
$CONFIG_DOTFILES_DIR/wofi/style.css
# MPD
$CONFIG_DOTFILES_DIR/mpd/mpd.conf
# Ncmpcpp
$CONFIG_DOTFILES_DIR/ncmpcpp/config
# MPV
$CONFIG_DOTFILES_DIR/mpv/mpv.conf
$CONFIG_DOTFILES_DIR/mpv/input.conf
# Mako
$CONFIG_DOTFILES_DIR/mako/config
# Avizo
$CONFIG_DOTFILES_DIR/avizo/config.ini
# Swappy
$CONFIG_DOTFILES_DIR/swappy/config
# GTK
$CONFIG_DOTFILES_DIR/gtk-3.0/settings.ini
# Emojis
$CONFIG_DOTFILES_DIR/fontconfig/fonts.conf
# bin
$CONFIG_DOTFILES_DIR/bin/power_menu
$CONFIG_DOTFILES_DIR/bin/share_file
$CONFIG_DOTFILES_DIR/bin/capture_visible
$CONFIG_DOTFILES_DIR/bin/capture_cut
$CONFIG_DOTFILES_DIR/bin/clipboard_list
$CONFIG_DOTFILES_DIR/bin/clipboard_list
$CONFIG_DOTFILES_DIR/bin/songinfo
$CONFIG_DOTFILES_DIR/bin/reset_sway_workspaces
$CONFIG_DOTFILES_DIR/bin/passwofi
)
home_files=(
$DOTFILES_DIR/.zshrc
$DOTFILES_DIR/.tmux.conf
)
files_to_remove=(
# Neovim
$CONFIG_DIR/nvim/lua
$CONFIG_DIR/nvim/init.lua
# Tut
$CONFIG_DIR/tut/themes
$CONFIG_DIR/tut/accounts.toml
$CONFIG_DIR/tut/config.toml
# Iamb
$CONFIG_DIR/iamb/config.toml
# Kitty
$CONFIG_DIR/kitty/kitty.conf
# Newsboat
$CONFIG_DIR/newsboat/urls
$CONFIG_DIR/newsboat/config
# Sway
$CONFIG_DIR/sway/config
$CONFIG_DIR/sway/wp.png
# Waybar
$CONFIG_DIR/waybar/config.jsonc
$CONFIG_DIR/waybar/mediaplayer.py
$CONFIG_DIR/waybar/style.css
# Wofi
$CONFIG_DIR/wofi/config
$CONFIG_DIR/wofi/style.css
# MPD
$CONFIG_DIR/mpd/mpd.conf
# Ncmpcpp
$CONFIG_DIR/ncmpcpp/config
# MPV
$CONFIG_DIR/mpv/mpv.conf
$CONFIG_DIR/mpv/input.conf
# Mako
$CONFIG_DIR/mako/config
# Avizo
$CONFIG_DIR/avizo/config.ini
# Swappy
$CONFIG_DIR/swappy/config
# GTK
$CONFIG_DIR/gtk-3.0/settings.ini
# Emojis
$CONFIG_DIR/fontconfig/fonts.conf
# bin
$CONFIG_DIR/bin/power_menu
$CONFIG_DIR/bin/share_file
$CONFIG_DIR/bin/capture_visible
$CONFIG_DIR/bin/capture_cut
$CONFIG_DIR/bin/clipboard_list
$CONFIG_DIR/bin/songinfo
$CONFIG_DIR/bin/reset_sway_workspaces
$CONFIG_DIR/bin/passwofi
# Home
$HOME/.zshrc
$HOME/.tmux.conf
)
dirs_to_create=(
$CONFIG_DIR/nvim
$CONFIG_DIR/tut
$CONFIG_DIR/iamb
$CONFIG_DIR/kitty
$CONFIG_DIR/newsboat
$CONFIG_DIR/sway
$CONFIG_DIR/waybar
$CONFIG_DIR/wofi
$CONFIG_DIR/mpd
$CONFIG_DIR/ncmpcpp
$CONFIG_DIR/mpv
$CONFIG_DIR/mako
$CONFIG_DIR/avizo
$CONFIG_DIR/swappy
$CONFIG_DIR/gtk-3.0
$CONFIG_DIR/fontconfig
$CONFIG_DIR/bin
)
for file in "${files_to_remove[@]}"; do
remove_file_if_exists "$file"
done
for dir in "${dirs_to_create[@]}"; do
create_dir_if_doesnt_exists "$dir"
done
for file in "${config_files[@]}"; do
echo "creating the link of $file"
absolute_path=$(readlink -f "$file")
echo " absolute path of $file is $absolute_path"
IFS="/" read -ra path_components <<< "$absolute_path"
last_two_levels="${path_components[-2]}/${path_components[-1]}"
echo " got the last_two_levels $last_two_levels"
ln -s "$file" $CONFIG_DIR/"$last_two_levels"
echo " $CONFIG_DIR/$last_two_levels added successfully"
done
for file in "${home_files[@]}"; do
echo "creating the link of the file $file"
ln -s "$file" $HOME/$(basename "$file")
echo " $HOME/$(basename "$file") added successfully"
done