forked from ChrisTitusTech/dwm-titus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·107 lines (90 loc) · 3.42 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
#!/bin/bash
# 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
}
# 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
}
# Function to install dependencies for Arch-based distributions
install_arch() {
sudo pacman -Syu --noconfirm
sudo pacman -S --noconfirm base-devel libconfig dbus libev libx11 libxcb libxext libgl libegl libepoxy meson pcre2 pixman uthash xcb-util-image xcb-util-renderutil xorgproto cmake
}
# Detect the distribution and install the appropriate packages
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)
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
picom_animations() {
# Clone the repository in the home/build directory
mkdir -p ~/build
if [ ! -d ~/build/picom ]; then
if ! git clone https://github.com/FT-Labs/picom.git ~/build/picom; then
echo "Failed to clone the repository"
return 1
fi
else
echo "Repository already exists, skipping clone"
fi
cd ~/build/picom || { echo "Failed to change directory to picom"; return 1; }
# Build the project
if ! meson setup --buildtype=release build; then
echo "Meson setup failed"
return 1
fi
if ! ninja -C build; then
echo "Ninja build failed"
return 1
fi
# Install the built binary
if ! sudo ninja -C build install; then
echo "Failed to install the built binary"
return 1
fi
echo "Picom animations installed successfully"
}
clone_config_folders() {
# Ensure the target directory exists
[ ! -d ~/.config ] && mkdir -p ~/.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" ~/.config/
echo "Cloned $dir_name to ~/.config/"
else
echo "Directory $dir_name does not exist, skipping"
fi
done
}
# Call the function
clone_config_folders
# Call the function
picom_animations
echo "All dependencies installed successfully."