Skip to content

Commit 8f8458f

Browse files
committed
update install.sh
1 parent 51f3d6d commit 8f8458f

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

install.sh

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ detect_distribution() {
4040
check_dependencies() {
4141
detect_distribution
4242
sudo "${p_m}" -y update && sudo "${p_m}" -y upgrade
43-
local dependencies=("nginx" "certbot" "python3-certbot-nginx")
43+
local dependencies=("nginx" "git" "certbot" "python3-certbot-nginx")
4444

4545
for dep in "${dependencies[@]}"; do
4646
if ! command -v "${dep}" &> /dev/null; then
@@ -206,6 +206,7 @@ check_installation() {
206206
# Change Paths
207207
path() {
208208
if systemctl is-active --quiet nginx && [ -f "/etc/nginx/sites-available/$saved_domain" ]; then
209+
209210
echo -e "${yellow}×××××××××××××××××××××××${rest}"
210211
read -p "Enter the new GRPC path (Service Name) [default: grpc]: " new_grpc_path
211212
new_grpc_path=${new_grpc_path:-grpc}
@@ -232,6 +233,35 @@ ${cyan}| WebSocket Path | ${yellow}$new_ws_path ${cyan}
232233
fi
233234
}
234235

236+
# Install random site
237+
install_random_fake_site() {
238+
if ! command -v nginx &> /dev/null; then
239+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
240+
echo -e "${red}Nginx is not installed.${rest}"
241+
exit 1
242+
fi
243+
244+
if [ ! -d "/var/www/html" ]; then
245+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
246+
echo -e "${red}/var/www/html does not exist.${rest}"
247+
exit 1
248+
fi
249+
250+
if [ ! -d "/var/www/website-templates" ]; then
251+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
252+
echo -e "${yellow}Downloading Websites list...${rest}"
253+
sudo git clone https://github.com/learning-zone/website-templates.git /var/www/website-templates
254+
fi
255+
256+
cd /var/www/website-templates
257+
sudo rm -rf /var/www/html/*
258+
random_folder=$(ls -d */ | shuf -n 1)
259+
sudo mv "$random_folder"/* /var/www/html
260+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
261+
echo -e "${green}Website Installed Successfully${rest}"
262+
echo -e "${yellow}×××××××××××××××××××××××${rest}"
263+
}
264+
235265
# Uninstall N R P
236266
uninstall() {
237267
# Check if NGINX is installed
@@ -268,7 +298,9 @@ echo -e "${yellow} 1) ${green}Install ${purple}*${rest}"
268298
echo -e "${purple} * ${rest}"
269299
echo -e "${yellow} 2) ${green}Change Paths${rest} ${purple}*${rest}"
270300
echo -e "${purple} * ${rest}"
271-
echo -e "${yellow} 3) ${green}Uninstall${rest} ${purple}*${rest}"
301+
echo -e "${yellow} 3) ${green}Install Fake Site${rest} ${purple}*${rest}"
302+
echo -e "${purple} * ${rest}"
303+
echo -e "${yellow} 4) ${green}Uninstall${rest} ${purple}*${rest}"
272304
echo -e "${purple} * ${rest}"
273305
echo -e "${yellow} 0) ${purple}Exit${rest}${purple} *${rest}"
274306
echo -e "${purple}***********************${rest}"
@@ -281,6 +313,9 @@ case "$choice" in
281313
path
282314
;;
283315
3)
316+
install_random_fake_site
317+
;;
318+
4)
284319
uninstall
285320
;;
286321
0)

0 commit comments

Comments
 (0)