mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-25 17:25:53 +00:00
dev
This commit is contained in:
114
ct/create_lxc.sh
114
ct/create_lxc.sh
@@ -9,26 +9,28 @@
|
||||
# This sets verbose mode if the global variable is set to "yes"
|
||||
# if [ "$VERBOSE" == "yes" ]; then set -x; fi
|
||||
|
||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/core.func)
|
||||
|
||||
# This function sets color variables for formatting output in the terminal
|
||||
# Colors
|
||||
YW=$(echo "\033[33m")
|
||||
YWB=$(echo "\033[93m")
|
||||
BL=$(echo "\033[36m")
|
||||
RD=$(echo "\033[01;31m")
|
||||
GN=$(echo "\033[1;92m")
|
||||
# YW=$(echo "\033[33m")
|
||||
# YWB=$(echo "\033[93m")
|
||||
# BL=$(echo "\033[36m")
|
||||
# RD=$(echo "\033[01;31m")
|
||||
# GN=$(echo "\033[1;92m")
|
||||
|
||||
# Formatting
|
||||
CL=$(echo "\033[m")
|
||||
UL=$(echo "\033[4m")
|
||||
BOLD=$(echo "\033[1m")
|
||||
BFR="\\r\\033[K"
|
||||
HOLD=" "
|
||||
TAB=" "
|
||||
# # Formatting
|
||||
# CL=$(echo "\033[m")
|
||||
# UL=$(echo "\033[4m")
|
||||
# BOLD=$(echo "\033[1m")
|
||||
# BFR="\\r\\033[K"
|
||||
# HOLD=" "
|
||||
# TAB=" "
|
||||
|
||||
# Icons
|
||||
CM="${TAB}✔️${TAB}${CL}"
|
||||
CROSS="${TAB}✖️${TAB}${CL}"
|
||||
INFO="${TAB}💡${TAB}${CL}"
|
||||
# # Icons
|
||||
# CM="${TAB}✔️${TAB}${CL}"
|
||||
# CROSS="${TAB}✖️${TAB}${CL}"
|
||||
# INFO="${TAB}💡${TAB}${CL}"
|
||||
|
||||
# This sets error handling options and defines the error_handler function to handle errors
|
||||
set -Eeuo pipefail
|
||||
@@ -46,52 +48,52 @@ function error_handler() {
|
||||
exit 200
|
||||
}
|
||||
|
||||
# This function displays a spinner.
|
||||
function spinner() {
|
||||
local frames=('⠋' '⠙' '⠹' '⠸' '⠼' '⠴' '⠦' '⠧' '⠇' '⠏')
|
||||
local spin_i=0
|
||||
local interval=0.1
|
||||
printf "\e[?25l"
|
||||
# # This function displays a spinner.
|
||||
# function 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.
|
||||
function 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.
|
||||
# function msg_info() {
|
||||
# local msg="$1"
|
||||
# echo -ne "${TAB}${YW}${HOLD}${msg}${HOLD}"
|
||||
# spinner &
|
||||
# SPINNER_PID=$!
|
||||
# }
|
||||
|
||||
function msg_warn() {
|
||||
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}${INFO}${YWB}${msg}${CL}"
|
||||
}
|
||||
# function msg_warn() {
|
||||
# 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}${INFO}${YWB}${msg}${CL}"
|
||||
# }
|
||||
|
||||
# This function displays a success message with a green color.
|
||||
function 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.
|
||||
# function 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.
|
||||
function 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.
|
||||
# function 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 checks for the presence of valid Container Storage and Template Storage locations
|
||||
msg_info "Validating Storage"
|
||||
|
||||
Reference in New Issue
Block a user