-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_configserver.sh
More file actions
104 lines (94 loc) · 2.89 KB
/
Copy pathinstall_configserver.sh
File metadata and controls
104 lines (94 loc) · 2.89 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
#!/bin/bash
set -e
# Colors
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
CYAN="\e[36m"
BOLD="\e[1m"
RESET="\e[0m"
# Output functions
info() { echo -e "${CYAN}[INFO]${RESET} $1"; }
success() { echo -e "${GREEN}[OK]${RESET} $1"; }
warn() { echo -e "${YELLOW}[WARN]${RESET} $1"; }
error() { echo -e "${RED}[ERROR]${RESET} $1"; }
# Progress bar with percentage
progress_bar() {
local duration=$1
local width=30
for ((i=0; i<=width; i++)); do
percent=$((i*100/width))
bar=$(printf "%0.s#" $(seq 1 $i))
spaces=$(printf "%0.s " $(seq 1 $((width-i))))
echo -ne "${BLUE}[${bar}${spaces}] ${percent}%${RESET}\r"
sleep $(awk "BEGIN {print $duration/$width}")
done
echo
}
info "Detecting distribution..."
if [ -f /etc/redhat-release ]; then
DISTRO="redhat"
success "Detected RedHat-based system"
yum -y install perl-libwww-perl.noarch perl-LWP-Protocol-https.noarch perl-GDGraph
elif [ -f /etc/debian_version ]; then
DISTRO="debian"
success "Detected Debian-based system"
apt-get update -y
apt-get -y install libwww-perl liblwp-protocol-https-perl libgd-graph-perl
else
error "Unsupported distribution"
exit 1
fi
install_package () {
NAME=$1
info "Installing ${BOLD}$NAME${RESET}..."
progress_bar 2
cd /usr/src
rm -fv /usr/src/${NAME}.tgz
wget -4 -q https://github.com/MrAriaNet/scripts/raw/main/${NAME}.tgz
tar -xzf ${NAME}.tgz
cd ${NAME}
sh install.sh
cd ..
rm -Rfv /usr/src/${NAME}*
success "$NAME installed successfully!"
}
# Detect DirectAdmin or cPanel
if [ -x /usr/local/directadmin/directadmin ]; then
success "DirectAdmin detected"
warn "Only CSF can be installed on DirectAdmin."
read -p "$(echo -e ${YELLOW}"Do you want to install CSF now? (y/n): "${RESET})" ans
if [[ "$ans" =~ ^[Yy]$ ]]; then
install_package csf
else
warn "CSF installation skipped."
fi
elif [ -x /usr/local/cpanel/cpanel ]; then
success "cPanel detected"
info "You can install CSF, CMC, CMM, and CMQ."
read -p "$(echo -e ${YELLOW}"Do you want to install ALL of them? (y/n): "${RESET})" all_ans
if [[ "$all_ans" =~ ^[Yy]$ ]]; then
for pkg in csf cmc cmm cmq; do
install_package $pkg
done
else
info "Select which ones to install:"
for pkg in csf cmc cmm cmq; do
read -p "$(echo -e ${YELLOW}"Install $pkg? (y/n): "${RESET})" ans
if [[ "$ans" =~ ^[Yy]$ ]]; then
install_package $pkg
else
warn "$pkg skipped."
fi
done
fi
else
warn "No DirectAdmin or cPanel detected."
info "Defaulting to CSF installation only."
read -p "$(echo -e ${YELLOW}"Do you want to install CSF? (y/n): "${RESET})" ans
if [[ "$ans" =~ ^[Yy]$ ]]; then
install_package csf
fi
fi
success "Installation process completed!"