This commit is contained in:
CanbiZ
2025-05-07 13:35:45 +02:00
parent 69a3d1b4d5
commit 3a88d6853d
5 changed files with 458 additions and 259 deletions

View File

@@ -5,36 +5,38 @@
# License: MIT
# https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
color() {
# Colors
YW=$(echo "\033[33m")
YWB=$(echo "\033[93m")
BL=$(echo "\033[36m")
RD=$(echo "\033[01;31m")
GN=$(echo "\033[1;92m")
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
# Formatting
CL=$(echo "\033[m")
BFR="\\r\\033[K"
BOLD=$(echo "\033[1m")
HOLD=" "
TAB=" "
# color() {
# # Colors
# YW=$(echo "\033[33m")
# YWB=$(echo "\033[93m")
# BL=$(echo "\033[36m")
# RD=$(echo "\033[01;31m")
# GN=$(echo "\033[1;92m")
# System
RETRY_NUM=10
RETRY_EVERY=3
# # Formatting
# CL=$(echo "\033[m")
# BFR="\\r\\033[K"
# BOLD=$(echo "\033[1m")
# HOLD=" "
# TAB=" "
# Icons
CM="${TAB}✔️${TAB}${CL}"
CROSS="${TAB}✖️${TAB}${CL}"
INFO="${TAB}💡${TAB}${CL}"
NETWORK="${TAB}📡${TAB}${CL}"
OS="${TAB}🖥${TAB}${CL}"
OSVERSION="${TAB}🌟${TAB}${CL}"
HOSTNAME="${TAB}🏠${TAB}${CL}"
GATEWAY="${TAB}🌐${TAB}${CL}"
DEFAULT="${TAB}${TAB}${CL}"
}
# # System
# RETRY_NUM=10
# RETRY_EVERY=3
# # Icons
# CM="${TAB}${TAB}${CL}"
# CROSS="${TAB}✖️${TAB}${CL}"
# INFO="${TAB}💡${TAB}${CL}"
# NETWORK="${TAB}📡${TAB}${CL}"
# OS="${TAB}🖥${TAB}${CL}"
# OSVERSION="${TAB}🌟${TAB}${CL}"
# HOSTNAME="${TAB}🏠${TAB}${CL}"
# GATEWAY="${TAB}🌐${TAB}${CL}"
# DEFAULT="${TAB}⚙️${TAB}${CL}"
# }
# Function to set STD mode based on verbosity
set_std_mode() {
@@ -86,45 +88,46 @@ error_handler() {
fi
}
# This function displays a spinner.
spinner() {
local frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
local spin_i=0
local interval=0.1
printf "\e[?25l"
# # This function displays a spinner.
# spinner() {
# local frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
# local spin_i=0
# local interval=0.1
# printf "\e[?25l"
local color="${YWB}"
# local color="${YWB}"
while true; do
printf "\r ${color}%s${CL}" "${frames[spin_i]}"
spin_i=$(((spin_i + 1) % ${#frames[@]}))
sleep "$interval"
done
}
# while true; do
# printf "\r ${color}%s${CL}" "${frames[spin_i]}"
# spin_i=$(((spin_i + 1) % ${#frames[@]}))
# sleep "$interval"
# done
# }
# This function displays an informational message with a yellow color.
msg_info() {
local msg="$1"
echo -ne "${TAB}${YW}${HOLD}${msg}${HOLD}"
spinner &
SPINNER_PID=$!
}
# # This function displays an informational message with a yellow color.
# msg_info() {
# local msg="$1"
# echo -ne "${TAB}${YW}${HOLD}${msg}${HOLD}"
# spinner &
# SPINNER_PID=$!
# }
# This function displays a success message with a green color.
msg_ok() {
if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi
printf "\e[?25h"
local msg="$1"
echo -e "${BFR}${CM}${GN}${msg}${CL}"
}
# # This function displays a success message with a green color.
# msg_ok() {
# if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi
# printf "\e[?25h"
# local msg="$1"
# echo -e "${BFR}${CM}${GN}${msg}${CL}"
# }
# # This function displays a error message with a red color.
# msg_error() {
# if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi
# printf "\e[?25h"
# local msg="$1"
# echo -e "${BFR}${CROSS}${RD}${msg}${CL}"
# }
# This function displays a error message with a red color.
msg_error() {
if [ -n "$SPINNER_PID" ] && ps -p "$SPINNER_PID" >/dev/null; then kill "$SPINNER_PID" >/dev/null; fi
printf "\e[?25h"
local msg="$1"
echo -e "${BFR}${CROSS}${RD}${msg}${CL}"
}
# This function sets up the Container OS by generating the locale, setting the timezone, and checking the network connection
setting_up_container() {
msg_info "Setting up Container OS"