mirror of https://github.com/tteck/Proxmox.git
Update debian-v3.sh
This commit is contained in:
parent
293869c8f5
commit
3c7cf891e4
|
@ -1,9 +1,16 @@
|
|||
#!/usr/bin/env bash -ex
|
||||
set -euo pipefail
|
||||
shopt -s inherit_errexit nullglob
|
||||
|
||||
APP="Debian"
|
||||
var_disk="2"
|
||||
var_cpu="1"
|
||||
var_ram="512"
|
||||
var_os="debian"
|
||||
var_version="11"
|
||||
NEXTID=$(pvesh get /cluster/nextid)
|
||||
INTEGER='^[0-9]+$'
|
||||
NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||
var_install="${NSAPP}-install"
|
||||
YW=`echo "\033[33m"`
|
||||
BL=`echo "\033[36m"`
|
||||
RD=`echo "\033[01;31m"`
|
||||
|
@ -14,8 +21,6 @@ CL=`echo "\033[m"`
|
|||
BFR="\\r\\033[K"
|
||||
HOLD="-"
|
||||
CM="${GN}✓${CL}"
|
||||
APP="Debian"
|
||||
NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||
while true; do
|
||||
read -p "This will create a New ${APP} LXC. Proceed(y/n)?" yn
|
||||
case $yn in
|
||||
|
@ -71,12 +76,12 @@ function default_settings() {
|
|||
CT_ID=$NEXTID
|
||||
echo -e "${DGN}Using CT Name ${BGN}$NSAPP${CL}"
|
||||
HN=$NSAPP
|
||||
echo -e "${DGN}Using Disk Size ${BGN}2${CL}${DGN}GB${CL}"
|
||||
DISK_SIZE="2"
|
||||
echo -e "${DGN}Using ${BGN}1${CL}${DGN}vCPU${CL}"
|
||||
CORE_COUNT="1"
|
||||
echo -e "${DGN}Using ${BGN}512${CL}${DGN}MiB RAM${CL}"
|
||||
RAM_SIZE="512"
|
||||
echo -e "${DGN}Using Disk Size ${BGN}$var_disk${CL}${DGN}GB${CL}"
|
||||
DISK_SIZE="$var_disk"
|
||||
echo -e "${DGN}Using ${BGN}$var_cpu${CL}${DGN}vCPU${CL}"
|
||||
CORE_COUNT="$var_cpu"
|
||||
echo -e "${DGN}Using ${BGN}$var_ram${CL}${DGN}MiB RAM${CL}"
|
||||
RAM_SIZE="$var_ram"
|
||||
echo -e "${DGN}Using Bridge ${BGN}vmbr0${CL}"
|
||||
BRG="vmbr0"
|
||||
echo -e "${DGN}Using Static IP Address ${BGN}DHCP${CL}"
|
||||
|
@ -150,9 +155,9 @@ header_info
|
|||
echo -e "${DGN}Using CT Password ${BGN}$PW1${CL}"
|
||||
echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}"
|
||||
echo -e "${DGN}Using CT Name ${BGN}$HN${CL}"
|
||||
echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: 2 "
|
||||
echo -e "${YW}Enter a Disk Size, or Press [ENTER] for Default: $var_disk "
|
||||
read DISK_SIZE
|
||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="2"; fi;
|
||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; fi;
|
||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo "ERROR! DISK SIZE MUST HAVE INTEGER NUMBER!"; exit; fi;
|
||||
echo -en "${DGN}Set Disk Size To ${BL}$DISK_SIZE${CL}${DGN}GB${CL}"
|
||||
echo -e " ${CM}${CL} \r"
|
||||
|
@ -165,9 +170,9 @@ header_info
|
|||
echo -e "${DGN}Using CT ID ${BGN}$CT_ID${CL}"
|
||||
echo -e "${DGN}Using CT Name ${BGN}$HN${CL}"
|
||||
echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}"
|
||||
echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: 1 "
|
||||
echo -e "${YW}Allocate CPU cores, or Press [ENTER] for Default: $var_cpu "
|
||||
read CORE_COUNT
|
||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="1"; fi;
|
||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; fi;
|
||||
echo -en "${DGN}Set Cores To ${BL}$CORE_COUNT${CL}${DGN}vCPU${CL}"
|
||||
echo -e " ${CM}${CL} \r"
|
||||
sleep 1
|
||||
|
@ -180,9 +185,9 @@ header_info
|
|||
echo -e "${DGN}Using CT Name ${BGN}$HN${CL}"
|
||||
echo -e "${DGN}Using Disk Size ${BGN}$DISK_SIZE${CL}${DGN}GB${CL}"
|
||||
echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}"
|
||||
echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: 512 "
|
||||
echo -e "${YW}Allocate RAM in MiB, or Press [ENTER] for Default: $var_ram "
|
||||
read RAM_SIZE
|
||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="512"; fi;
|
||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; fi;
|
||||
echo -en "${DGN}Set RAM To ${BL}$RAM_SIZE${CL}${DGN}MiB RAM${CL}"
|
||||
echo -e " ${CM}${CL} \n"
|
||||
sleep 1
|
||||
|
@ -305,12 +310,9 @@ if [ "$CT_TYPE" == "1" ]; then
|
|||
FEATURES="nesting=1"
|
||||
fi
|
||||
|
||||
TEMP_DIR=$(mktemp -d)
|
||||
pushd $TEMP_DIR >/dev/null
|
||||
|
||||
export CTID=$CT_ID
|
||||
export PCT_OSTYPE=debian
|
||||
export PCT_OSVERSION=11
|
||||
export PCT_OSTYPE=$var_os
|
||||
export PCT_OSVERSION=$var_version
|
||||
export PCT_DISK_SIZE=$DISK_SIZE
|
||||
export PCT_OPTIONS="
|
||||
-features $FEATURES
|
||||
|
@ -328,7 +330,7 @@ msg_info "Starting LXC Container"
|
|||
pct start $CTID
|
||||
msg_ok "Started LXC Container"
|
||||
|
||||
lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/setup/debian-install.sh)" || exit
|
||||
lxc-attach -n $CTID -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/dev/setup/$var_install.sh)" || exit
|
||||
|
||||
IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}')
|
||||
|
||||
|
|
Loading…
Reference in New Issue