mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 05:57:26 +00:00
dev
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user