-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrabid-installer.sh
180 lines (160 loc) · 6.33 KB
/
rabid-installer.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
#!/bin/bash
# rabid-installer.sh By The Rabbithole Project
# This script is a work in progress, eventually iy aims to work with any Linux distribution that
# uses apt, pacman, xbps-install or emerge as a package manager. (Arch, Debian, Ubuntu,
# Gentoo, Void, etc.)
# Set the project directory
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Check which package manager is installed
if command -v apt >/dev/null 2>&1; then
PACKAGE_MANAGER="apt"
elif command -v pacman >/dev/null 2>&1; then
PACKAGE_MANAGER="pacman"
if command -v yay >/dev/null 2>&1; then
PACKAGE_MANAGER="yay"
fi
elif command -v emerge >/dev/null 2>&1; then
PACKAGE_MANAGER="emerge"
elif command -v xbps-install >/dev/null 2>&1; then
PACKAGE_MANAGER="xbps"
else
echo "No recognized package manager is available on your system. Exiting."
exit 1
fi
# Core dependencies
if [ $PACKAGE_MANAGER == "apt" ]; then
CORE_DEPENDENCIES=(
awesome
rofi
autorandr
picom
fonts-ubuntu
lxqt-policykit
lxqt-powermanagement
tmux
)
DE_LIKE_DEPENDENCIES=(
volumeicon-alsa
network-manager-gnome
blueman
flameshot
)
# Adding PPA for linux-wifi-hotspot
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:lakinduakash/lwh
sudo apt update
sudo apt install linux-wifi-hotspot -y
elif [ $PACKAGE_MANAGER == "yay" ]; then
CORE_DEPENDENCIES=(
awesome
rofi
rofi-themes-collection-git
autorandr
picom
ttf-ubuntu-font-family
lxqt-policykit
lxqt-powermanagement
beautyline
tmux
)
# DE-Like dependencies
DE_LIKE_DEPENDENCIES=(
volumeicon
network-manager-applet
blueman
flameshot
linux-wifi-hotspot
)
fi
check_and_install() {
if [ $PACKAGE_MANAGER == "apt" ]; then
dpkg -s "$1" >/dev/null 2>&1 || sudo apt install "$1" -y
elif [ $PACKAGE_MANAGER == "pacman" ] || [ $PACKAGE_MANAGER == "yay" ]; then
pacman -Q "$1" >/dev/null 2>&1 || $PACKAGE_MANAGER -S "$1"
elif [ $PACKAGE_MANAGER == "emerge" ]; then
emerge -pq "$1" >/dev/null 2>&1 || sudo emerge --ask "$1"
elif [ $PACKAGE_MANAGER == "xbps" ]; then
xbps-query -R "$1" >/dev/null 2>&1 || sudo xbps-install -Sy "$1"
fi
}
# Check and install dependencies
echo "Choose your installation type:"
echo "1. Core (For Advanced Users)"
echo "2. DE-Like (Recommended)"
read -p "Enter your choice (1-2): " INSTALL_TYPE
# Use check_if_installed instead of check_and_install in the script
if [ "$INSTALL_TYPE" = "1" ]; then
for pkg in "${CORE_DEPENDENCIES[@]}"; do
echo "Checking and installing $pkg..."
check_and_install "$pkg"
done
elif [ "$INSTALL_TYPE" = "2" ]; then
for pkg in "${CORE_DEPENDENCIES[@]}"; do
echo "Checking and installing $pkg..."
check_and_install "$pkg"
done
for pkg in "${DE_LIKE_DEPENDENCIES[@]}"; do
echo "Checking and installing $pkg..."
check_and_install "$pkg"
done
fi
if [ ! -d "$HOME/.config/awesome" ]; then
mkdir -p "$HOME/.config/awesome"
fi
if [ ! -d "$HOME/.config/picom" ]; then
mkdir -p "$HOME/.config/picom"
fi
# Check the user's installation choice and copy the corresponding settings file.
# But check first if the user has an existing configuration.
if [ "$INSTALL_TYPE" = "1" ]; then
if [ ! -f "$HOME/.config/awesome/settings.lua" ]; then
mkdir -p "$HOME/.config/awesome"
cp "$PROJECT_DIR/installer/settings-core.lua" "$HOME/.config/awesome/settings.lua"
else
echo "An existing configuration file has been found at ~/.config/awesome/settings.lua."
cp "$PROJECT_DIR/installer/settings-core.lua" "$HOME/.config/awesome/settings.lua.new"
echo "The new configuration has been copied to ~/.config/awesome/settings.lua.new."
fi
elif [ "$INSTALL_TYPE" = "2" ]; then
if [ ! -f "$HOME/.config/awesome/settings.lua" ]; then
cp "$PROJECT_DIR/installer/settings-full.lua" "$HOME/.config/awesome/settings.lua"
else
echo "An existing configuration file has been found at ~/.config/awesome/settings.lua."
cp "$PROJECT_DIR/installer/settings-full.lua" "$HOME/.config/awesome/settings.lua.new"
echo "The new configuration has been copied to ~/.config/awesome/settings.lua.new."
fi
fi
# If the package manager is not 'yay', download the rofi themes and ubuntu fonts
if [ $PACKAGE_MANAGER != "yay" ]; then
# Clone the Rofi themes collection if it doesn't exist
if [ ! -d "$HOME/.local/share/rofi/themes" ]; then
echo "Downloading Rofi themes collection..."
mkdir -p "$HOME/.local/share/rofi/themes"
git clone https://github.com/newmanls/rofi-themes-collection.git "$HOME/.local/share/rofi/themes"
fi
# Download and extract Ubuntu Font Family if it doesn't exist
if [ ! -d "/usr/share/fonts/ubuntu-font-family" ]; then
echo "Downloading Ubuntu Font Family..."
sudo mkdir -p "/usr/share/fonts/ubuntu-font-family"
sudo wget -O "/usr/share/fonts/ubuntu-font-family/Ubuntu.zip" https://assets.ubuntu.com/v1/fad7939b-ubuntu-font-family-0.83.zip
sudo unzip "/usr/share/fonts/ubuntu-font-family/Ubuntu.zip" -d "/usr/share/fonts/ubuntu-font-family"
fi
# Install BeautyLine icons if they don't exist
if [ ! -d "/usr/share/icons/BeautyLine" ]; then
echo "Copying BeautyLine icons and updating font cache..."
sudo cp -R $PROJECT_DIR/installer/BeautyLine /usr/share/icons/BeautyLine
sudo gtk-update-icon-cache /usr/share/icons/BeautyLine
fi
fi
# Copy rabbithole.desktop to /usr/share/xsessions/
echo "Copying rabbithole.desktop to /usr/share/xsessions/..."
sudo cp "$PROJECT_DIR/installer/rabbithole.desktop" /usr/share/xsessions/
echo "Rabbithole should now be visible in your display manager."
# Copy picom.conf into $HOME/.config/picom/
echo "Copying picom.conf to $HOME/.config/picom/..."
cp "$PROJECT_DIR/installer/picom.conf" "$HOME/.config/picom/picom.conf"
# Copy the configuratioin files to $HOME/.config/awesome/
echo "Copying Rabbithole's configuration files to $HOME/.config/awesome/..."
cp -R "$PROJECT_DIR/"* "$HOME/.config/awesome"
echo "Done! You can now log out and log back in with Rabbithole."
echo "Don't forget to set your rofi theme with the rofi-theme-selector when you log in!"