-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·64 lines (54 loc) · 1.62 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
#!/bin/bash
# Define colors
readonly COLOR_YELLOW=$(tput setaf 3)
readonly COLOR_GREEN=$(tput setaf 2)
readonly COLOR_GREY=$(tput setaf 8)
readonly COLOR_DARK_RED=$(tput setaf 1)
readonly COLOR_BLUE=$(tput setaf 4)
readonly COLOR_RESET=$(tput sgr0)
# Function to prompt for Yes/No
prompt_yna() {
local prompt_message="$1"
local choice
while true; do
read -rp "${COLOR_GREEN}${prompt_message} (Y/N): ${COLOR_RESET}" choice
case $choice in
[Yy]*) return 0 ;;
[Nn]*) return 1 ;;
*) echo "${COLOR_DARK_RED}:: Please answer Y or N.${COLOR_RESET}" ;;
esac
done
}
# Function to check if a package is installed
is_package_installed() {
pacman -Qs "$1" &>/dev/null
}
# Function to check if a command is available
command_exists() {
command -v "$1" &>/dev/null
}
# Function to prompt for installation confirmation
prompt_installation() {
if prompt_yna ":: Do you want to continue with the installation?"; then
return 0
else
echo "${COLOR_YELLOW}:: Installation aborted.${COLOR_RESET}"
exit 0
fi
}
# Main function
main() {
# install packages from install-packages.sh
source ./install/install-packages.sh
# Copy configuration files
source ./install/copy-config.sh
echo "${COLOR_GREEN}:: Installation completed successfully.${COLOR_RESET}"
echo "${COLOR_GREEN}:: Please reboot your system to apply all changes!${COLOR_RESET}"
}
# Main script execution
if [ -f /etc/arch-release ]; then
prompt_installation
main
else
echo "${COLOR_YELLOW}:: Sorry, Script only allows Arch Linux to run.${COLOR_RESET}"
fi