mirror of https://github.com/tteck/Proxmox.git
				
				
				
			Update create_lxc.sh
This commit is contained in:
		
							parent
							
								
									35baa41feb
								
							
						
					
					
						commit
						56615fbe79
					
				| 
						 | 
					@ -5,6 +5,7 @@ RD=`echo "\033[01;31m"`
 | 
				
			||||||
GN=`echo "\033[1;92m"`
 | 
					GN=`echo "\033[1;92m"`
 | 
				
			||||||
CL=`echo "\033[m"`
 | 
					CL=`echo "\033[m"`
 | 
				
			||||||
CM="${GN}✓${CL}"
 | 
					CM="${GN}✓${CL}"
 | 
				
			||||||
 | 
					CROSS="${RD}✗${CL}"
 | 
				
			||||||
BFR="\\r\\033[K"
 | 
					BFR="\\r\\033[K"
 | 
				
			||||||
HOLD="-"
 | 
					HOLD="-"
 | 
				
			||||||
set -o errexit
 | 
					set -o errexit
 | 
				
			||||||
| 
						 | 
					@ -33,7 +34,15 @@ function msg_ok() {
 | 
				
			||||||
   local msg="$1"
 | 
					   local msg="$1"
 | 
				
			||||||
   echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 | 
					   echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					function msg_error() {
 | 
				
			||||||
 | 
					    local msg="$1"
 | 
				
			||||||
 | 
					    echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Validating Storage"
 | 
					msg_info "Validating Storage"
 | 
				
			||||||
 | 
					VALID=$(pvesm status -content rootdir | awk 'NR>1')
 | 
				
			||||||
 | 
					if [ -z "$VALID" ]; then msg_error "Unable to detect a valid storage location."; exit 1; fi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function select_storage() {
 | 
					function select_storage() {
 | 
				
			||||||
  local CLASS=$1
 | 
					  local CLASS=$1
 | 
				
			||||||
  local CONTENT
 | 
					  local CONTENT
 | 
				
			||||||
| 
						 | 
					@ -57,10 +66,7 @@ function select_storage() {
 | 
				
			||||||
    MENU+=( "$TAG" "$ITEM" "OFF" )
 | 
					    MENU+=( "$TAG" "$ITEM" "OFF" )
 | 
				
			||||||
  done < <(pvesm status -content $CONTENT | awk 'NR>1')
 | 
					  done < <(pvesm status -content $CONTENT | awk 'NR>1')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if [ $((${#MENU[@]}/3)) -eq 0 ]; then            
 | 
					  if [ $((${#MENU[@]}/3)) -eq 1 ]; then          
 | 
				
			||||||
    echo -e "'$CONTENT_LABEL' needs to be selected for at least one storage location."
 | 
					 | 
				
			||||||
    die "Unable to detect valid storage location."
 | 
					 | 
				
			||||||
  elif [ $((${#MENU[@]}/3)) -eq 1 ]; then          
 | 
					 | 
				
			||||||
    printf ${MENU[0]}
 | 
					    printf ${MENU[0]}
 | 
				
			||||||
  else                                             
 | 
					  else                                             
 | 
				
			||||||
    local STORAGE
 | 
					    local STORAGE
 | 
				
			||||||
| 
						 | 
					@ -117,4 +123,3 @@ msg_info "Creating LXC Container"
 | 
				
			||||||
pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} ${PCT_OPTIONS[@]} >/dev/null ||
 | 
					pct create $CTID ${TEMPLATE_STORAGE}:vztmpl/${TEMPLATE} ${PCT_OPTIONS[@]} >/dev/null ||
 | 
				
			||||||
  die "A problem occured while trying to create container."
 | 
					  die "A problem occured while trying to create container."
 | 
				
			||||||
msg_ok "LXC Container ${BL}$CTID${CL} ${GN}was successfully created."
 | 
					msg_ok "LXC Container ${BL}$CTID${CL} ${GN}was successfully created."
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue