mirror of
https://github.com/tteck/Proxmox.git
synced 2024-12-27 10:57:02 +02:00
Update create_lxc.sh
This commit is contained in:
parent
785ca697b3
commit
dc446ad109
@ -1,11 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
shopt -s expand_aliases
|
||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||
YW=`echo "\033[33m"`
|
||||
BL=`echo "\033[36m"`
|
||||
RD=`echo "\033[01;31m"`
|
||||
@ -14,8 +7,23 @@ CL=`echo "\033[m"`
|
||||
CM="${GN}✓${CL}"
|
||||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
set -o errexit
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
shopt -s expand_aliases
|
||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||
trap die ERR
|
||||
|
||||
function error_exit() {
|
||||
trap - ERR
|
||||
local reason="Unknown failure occured."
|
||||
local msg="${1:-$reason}"
|
||||
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
|
||||
echo -e "$flag $msg" 1>&2
|
||||
exit $EXIT
|
||||
}
|
||||
|
||||
function msg_info() {
|
||||
local msg="$1"
|
||||
echo -ne " ${HOLD} ${YW}${msg}..."
|
||||
@ -26,28 +34,6 @@ function msg_ok() {
|
||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||
}
|
||||
|
||||
function error_exit() {
|
||||
trap - ERR
|
||||
local DEFAULT='Unknown failure occured.'
|
||||
local REASON="\e[97m${1:-$DEFAULT}\e[39m"
|
||||
local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE"
|
||||
msg "$FLAG $REASON" 1>&2
|
||||
exit $EXIT
|
||||
}
|
||||
function warn() {
|
||||
local REASON="\e[97m$1\e[39m"
|
||||
local FLAG="\e[93m[WARNING]\e[39m"
|
||||
msg "$FLAG $REASON"
|
||||
}
|
||||
function info() {
|
||||
local REASON="$1"
|
||||
local FLAG="\e[36m[INFO]\e[39m"
|
||||
msg "$FLAG $REASON"
|
||||
}
|
||||
function msg() {
|
||||
local TEXT="$1"
|
||||
echo -e "$TEXT"
|
||||
}
|
||||
function select_storage() {
|
||||
local CLASS=$1
|
||||
local CONTENT
|
||||
@ -100,10 +86,10 @@ if pct status $CTID &>/dev/null; then
|
||||
fi
|
||||
|
||||
TEMPLATE_STORAGE=$(select_storage template) || exit
|
||||
msg_ok "Using ${BL}$TEMPLATE_STORAGE${CL} ${GN}for Template Storage."
|
||||
msg_ok "Using ${BL}ℹ $TEMPLATE_STORAGE${CL} ${GN}for Template Storage."
|
||||
|
||||
CONTAINER_STORAGE=$(select_storage container) || exit
|
||||
msg_ok "Using ${BL}$CONTAINER_STORAGE${CL} ${GN}for Container Storage."
|
||||
msg_ok "Using ${BL}ℹ $CONTAINER_STORAGE${CL} ${GN}for Container Storage."
|
||||
|
||||
msg_info "Updating LXC Template List"
|
||||
pveam update >/dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user