mirror of
https://github.com/tteck/Proxmox.git
synced 2024-11-23 00:33:20 +01:00
Update create_lxc.sh
update validate storage check
This commit is contained in:
parent
3c89ba2b56
commit
f1b76b3949
@ -8,22 +8,6 @@ CM="${GN}✓${CL}"
|
|||||||
CROSS="${RD}✗${CL}"
|
CROSS="${RD}✗${CL}"
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
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 occurred."
|
|
||||||
local msg="${1:-$reason}"
|
|
||||||
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
|
|
||||||
echo -e "$flag $msg" 1>&2
|
|
||||||
exit $EXIT
|
|
||||||
}
|
|
||||||
|
|
||||||
function msg_info() {
|
function msg_info() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
@ -40,8 +24,27 @@ function msg_error() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg_info "Validating Storage"
|
msg_info "Validating Storage"
|
||||||
VALID=$(pvesm status -content rootdir | awk 'NR>1')
|
VALIDCT=$(pvesm status -content rootdir | awk 'NR>1')
|
||||||
if [ -z "$VALID" ]; then msg_error "Unable to detect a valid storage location."; exit 1; fi;
|
if [ -z "$VALIDCT" ]; then msg_error "Unable to detect a valid Container Storage location."; exit 1; fi;
|
||||||
|
VALIDTMP=$(pvesm status -content vztmpl | awk 'NR>1')
|
||||||
|
if [ -z "$VALIDTMP" ]; then msg_error "Unable to detect a valid Template Storage location."; exit 1; fi;
|
||||||
|
|
||||||
|
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 occurred."
|
||||||
|
local msg="${1:-$reason}"
|
||||||
|
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
|
||||||
|
echo -e "$flag $msg" 1>&2
|
||||||
|
exit $EXIT
|
||||||
|
}
|
||||||
|
|
||||||
function select_storage() {
|
function select_storage() {
|
||||||
local CLASS=$1
|
local CLASS=$1
|
||||||
|
Loading…
Reference in New Issue
Block a user