-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·202 lines (173 loc) · 6.1 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
#!/bin/sh
SRCDIR="$HOME/src"
# Ensure the target directory exists
if [ ! -d "$SRCDIR" ]; then
# Create the directory if it does not exist
mkdir -p "$SRCDIR"
echo "Directory '$SRCDIR' created."
else
echo "Directory '$SRCDIR' already exists."
fi
# Function to install dependencies for Debian-based distributions
#install_debian() {
#sudo apt update
#sudo apt install -y libconfig-dev libdbus-1-dev libegl-dev libev-dev libgl-dev libepoxy-dev libpcre2-dev libpixman-1-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-glx0-dev libxcb-image0-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev libxcb-util-dev libxcb-xfixes0-dev libxext-dev meson ninja-build uthash-dev cmake libxft-dev libimlib2-dev libxinerama-dev libxcb-res0-dev xorg-xev xorg-xbacklight alsa-utils
#}
# Function to install dependencies for Red Hat-based distributions
#install_redhat() {
#sudo yum groupinstall -y "Development Tools"
#sudo yum install -y dbus-devel gcc git libconfig-devel libdrm-devel libev-devel libX11-devel libX11-xcb libXext-devel libxcb-devel libGL-devel libEGL-devel libepoxy-devel meson ninja-build pcre2-devel pixman-devel uthash-devel xcb-util-image-devel xcb-util-renderutil-devel xorg-x11-proto-devel xcb-util-devel cmake libxft-devel libimlib2-devel libxinerama-devel libxcb-res0-devel xorg-xev xorg-xbacklight alsa-utils
#}
install_arch() {
sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm --needed base-devel libx11 libxinerama libxft imlib2 git dash shotgun hacksaw picom feh helix fastfetch alacritty mpv pulsemixer xorg-server xorg-xinit zoxide eza starship pcmanfm-gtk3
}
if [ -f /etc/os-release ]; then
. /etc/os-release
case "$ID" in
# debian|ubuntu)
# echo "Detected Debian-based distribution"
# install_debian
# ;;
# rhel|centos|fedora)
# echo "Detected Red Hat-based distribution"
# install_redhat
# ;;
arch|cachyos)
echo "Detected Arch-based distribution"
install_arch
;;
*)
echo "Unsupported distribution"
exit 1
;;
esac
else
echo "/etc/os-release not found. Unsupported distribution"
exit 1
fi
clone_mkdwm() {
# Clone the repository in the home/src directory
if [ ! -d $SRCDIR/mk-dwm ]; then
if ! git clone https://github.com/Markov-Komarov/mk-dwm.git $SRCDIR/mk-dwm; then
echo "Failed to clone the repository"
return 1
fi
else
echo "Repository already exists, skipping clone"
fi
cd $SRCDIR/mk-dwm || { echo "Failed to change directory to mk-dwm"; return 1; }
# Build the project
if ! make -s clean; then
echo "Make cleanup failed"
return 1
fi
# Install the built binary
if ! sudo make -s clean install; then
echo "Failed to install the built binary"
return 1
fi
echo "mk-dwm installed successfully"
}
clone_mkblocks() {
# Clone the repository in the home/src directory
if [ ! -d $SRCDIR/mk-blocks ]; then
if ! git clone https://github.com/Markov-Komarov/mk-blocks.git $SRCDIR/mk-blocks; then
echo "Failed to clone the repository"
return 1
fi
else
echo "Repository already exists, skipping clone"
fi
cd $SRCDIR/mk-blocks || { echo "Failed to change directory to mk-blocks"; return 1; }
# Build the project
if ! make -s clean; then
echo "Make cleanup failed"
return 1
fi
# Install the built binary
if ! sudo make -s clean install; then
echo "Failed to install the built binary"
return 1
fi
echo "mk-blocks installed successfully"
}
clone_mkterm() {
# Clone the repository in the home/src directory
if [ ! -d $SRCDIR/mk-st ]; then
if ! git clone https://github.com/Markov-Komarov/mk-st.git $SRCDIR/mk-st; then
echo "Failed to clone the repository"
return 1
fi
else
echo "Repository already exists, skipping clone"
fi
cd $SRCDIR/mk-st || { echo "Failed to change directory to st"; return 1; }
# Build the project
if ! make -s clean; then
echo "Make cleanup failed"
return 1
fi
# Install the built binary
if ! sudo make -s clean install; then
echo "Failed to install the built binary"
return 1
fi
echo "mk-st installed successfully"
}
clone_mkmenu() {
# Clone the repository in the home/src directory
if [ ! -d $SRCDIR/mk-dmenu ]; then
if ! git clone https://github.com/Markov-Komarov/mk-dmenu.git $SRCDIR/mk-dmenu; then
echo "Failed to clone the repository"
return 1
fi
else
echo "Repository already exists, skipping clone"
fi
cd $SRCDIR/mk-dmenu || { echo "Failed to change directory to dmenu"; return 1; }
# Build the project
if ! make -s clean; then
echo "Make cleanup failed"
return 1
fi
# Install the built binary
if ! sudo make -s clean install; then
echo "Failed to install the built binary"
return 1
fi
echo "mk-dmenu installed successfully"
}
clone_shbin_files() {
# Clone the directory to ~/local/
if ! cp -r bin $HOME/.local; then
echo "Cloned bin files to .local/bin failed"
return 1
else
echo "Cloned bin files to .local/bin"
fi
}
clone_config_folders() {
# Ensure the target directory exists
[ ! -d $HOME/.config ] && mkdir -p $HOME/.config
# Iterate over all directories in config/*
for dir in config/*/; do
# Extract the directory name
dir_name=$(basename "$dir")
# Clone the directory to ~/.config/
if [ -d "$dir" ]; then
cp -r "$dir" $HOME/.config
echo "Cloned $dir_name to ~/.config/"
else
echo "Directory $dir_name does not exist, skipping"
fi
done
}
# Call the functions
clone_mkdwm
clone_mkblocks
clone_mkterm
clone_mkmenu
clone_shbin_files
clone_config_folders
echo "All dependencies installed successfully."