mirror of https://github.com/tteck/Proxmox.git
parent
e7ec3d0275
commit
8e331fcbff
208
ct/adguard-v4.sh
208
ct/adguard-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${GN}
|
echo -e "${GN}
|
||||||
___ __ __
|
___ __ __
|
||||||
/ | ____/ /___ ___ ______ __________/ /
|
/ | ____/ /___ ___ ______ __________/ /
|
||||||
/ /| |/ __ / __ / / / / __ / ___/ __ /
|
/ /| |/ __ / __ / / / / __ / ___/ __ /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/blocky-v4.sh
208
ct/blocky-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
____ __ __
|
____ __ __
|
||||||
/ __ )/ /___v4_____/ /____ __
|
/ __ )/ /___v4_____/ /____ __
|
||||||
/ __ / / __ \/ ___/ //_/ / / /
|
/ __ / / __ \/ ___/ //_/ / / /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
210
ct/casaos-v4.sh
210
ct/casaos-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
______ ____ _____
|
______ ____ _____
|
||||||
/ ____/___ __v4______ _/ __ \/ ___/
|
/ ____/___ __v4______ _/ __ \/ ___/
|
||||||
/ / / __ `/ ___/ __ `/ / / /\__ \
|
/ / / __ `/ ___/ __ `/ / / /\__ \
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
____ _____
|
____ _____
|
||||||
/ __ \____ ____ ____ ___ ____ ____ / ___/__ ______ _____
|
/ __ \____ ____ ____ ___ ____ ____ / ___/__ ______ _____
|
||||||
/ / / / __ / _ \/ __ __ \/ __ \/ __ \ \__ \/ / / / __ \/ ___/
|
/ / / / __ / _ \/ __ __ \/ __ \/ __ \ \__ \/ / / / __ \/ ___/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/dashy-v4.sh
208
ct/dashy-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
____ __
|
____ __
|
||||||
/ __ \____ ______/ /_ __ __
|
/ __ \____ ______/ /_ __ __
|
||||||
/ / / / __ / ___/ __ \/ / / /
|
/ / / / __ / ___/ __ \/ / / /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
210
ct/deconz-v4.sh
210
ct/deconz-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
__ __________ _ _______
|
__ __________ _ _______
|
||||||
____/ /v4 / ____/ __ \/ | / /__ /
|
____/ /v4 / ____/ __ \/ | / /__ /
|
||||||
/ __ / _ \/ / / / / / |/ / / /
|
/ __ / _ \/ / / / / / |/ / / /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
|
210
ct/docker-v4.sh
210
ct/docker-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
____ __
|
____ __
|
||||||
/ __ \____ _____/ /_v4__ _____
|
/ __ \____ _____/ /_v4__ _____
|
||||||
/ / / / __ \/ ___/ //_/ _ \/ ___/
|
/ / / / __ \/ ___/ //_/ _ \/ ___/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -232,7 +256,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
EOF
|
EOF
|
||||||
|
|
224
ct/emby-v4.sh
224
ct/emby-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${DGN}
|
echo -e "${DGN}
|
||||||
______ __
|
______ __
|
||||||
/ ____/___ v4_ / /_ __ __
|
/ ____/___ v4_ / /_ __ __
|
||||||
/ __/ / __ __ \/ __ \/ / / /
|
/ __/ / __ __ \/ __ \/ / / /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
||||||
|
@ -98,131 +98,155 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
|
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
|
||||||
"18.04" "Bionic" OFF \
|
"18.04" "Bionic" OFF \
|
||||||
"20.04" "Focal" ON \
|
"20.04" "Focal" ON \
|
||||||
"21.10" "Impish" OFF \
|
"21.10" "Impish" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" OFF \
|
"1" "Unprivileged" OFF \
|
||||||
"0" "Privileged" ON \
|
"0" "Privileged" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -241,7 +265,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: c 226:0 rwm
|
lxc.cgroup2.devices.allow: c 226:0 rwm
|
||||||
lxc.cgroup2.devices.allow: c 226:128 rwm
|
lxc.cgroup2.devices.allow: c 226:128 rwm
|
||||||
lxc.cgroup2.devices.allow: c 29:0 rwm
|
lxc.cgroup2.devices.allow: c 29:0 rwm
|
||||||
|
|
208
ct/emqx-v4.sh
208
ct/emqx-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
________ _______v4 _ __
|
________ _______v4 _ __
|
||||||
/ ____/ |/ / __ \ | |/ /
|
/ ____/ |/ / __ \ | |/ /
|
||||||
/ __/ / /|_/ / / / / | /
|
/ __/ / /|_/ / / / / | /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/esphome-v4.sh
208
ct/esphome-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${CL}
|
echo -e "${CL}
|
||||||
___________ ____ __ ______ __ _________
|
___________ ____ __ ______ __ _________
|
||||||
/ ____/ ___// __ \/ / / / __ \/ |/ / ____/
|
/ ____/ ___// __ \/ / / / __ \/ |/ / ____/
|
||||||
/ __/ \__ \/ /_/ / /_/ / / / / /|_/ / __/
|
/ __/ \__ \/ /_/ / /_/ / / / / /|_/ / __/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/grafana-v4.sh
208
ct/grafana-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
______ ____
|
______ ____
|
||||||
/ ____/________ _/ __/___ _____ ____ _
|
/ ____/________ _/ __/___ _____ ____ _
|
||||||
/ / __/ ___/ __ / /_/ __ / __ \/ __ /
|
/ / __/ ___/ __ / /_/ __ / __ \/ __ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/grocy-v4.sh
208
ct/grocy-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
____ __________ _______ __
|
____ __________ _______ __
|
||||||
/ __ / ___/ __ \/ ___/ / / /
|
/ __ / ___/ __ \/ ___/ / / /
|
||||||
/ /_/ / / / /_/ / /__/ /_/ /
|
/ /_/ / / / /_/ / /__/ /_/ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ __ _ __ ____ ____ __ __ __
|
__ __ _ __ ____ ____ __ __ __
|
||||||
/ / / /__ (_)___ ___ ____/ /_v4 _/ / / / __ \____ ______/ /_ / /_ ____ ____ __________/ /
|
/ / / /__ (_)___ ___ ____/ /_v4 _/ / / / __ \____ ______/ /_ / /_ ____ ____ __________/ /
|
||||||
/ /_/ / _ \/ / __ __ \/ __ / __ / / / / / / / __ / ___/ __ \/ __ \/ __ \/ __ / ___/ __ /
|
/ /_/ / _ \/ / __ __ \/ __ / __ / / / / / / / __ / ___/ __ \/ __ \/ __ \/ __ / ___/ __ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
__ __ ___ _ __ __ ______
|
__ __ ___ _ __ __ ______
|
||||||
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___v4________
|
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___v4________
|
||||||
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \
|
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,8 +257,8 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
if [ "$CT_TYPE" == "0" ]; then
|
if [ "$CT_TYPE" == "0" ]; then
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ __ ___ _ __ __
|
__ __ ___ _ __ __
|
||||||
/ / / /___ ____ ___ ___ v4 / | __________(_)____/ /_____ _____ / /_
|
/ / / /___ ____ ___ ___ v4 / | __________(_)____/ /_____ _____ / /_
|
||||||
/ /_/ / __ \/ __ __ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ / __ \/ __/
|
/ /_/ / __ \/ __ __ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ / __ \/ __/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
if [ "$CT_TYPE" == "0" ]; then
|
if [ "$CT_TYPE" == "0" ]; then
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
@ -244,7 +268,7 @@ lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=
|
||||||
lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file
|
lxc.mount.entry: /dev/ttyACM1 dev/ttyACM1 none bind,optional,create=file
|
||||||
EOF
|
EOF
|
||||||
else
|
else
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
__ ______ __ _____________ ____ ________ ____________
|
__ ______ __ _____________ ____ ________ ____________
|
||||||
/ / / / __ \/ |/ / ____/ __ )/ __ \/ _/ __ \/ ____/ ____/
|
/ / / / __ \/ |/ / ____/ __ )/ __ \/ _/ __ \/ ____/ ____/
|
||||||
/ /_/ / / / / /|_/ / __/ / __ / /_/ // // / / / / __/ __/
|
/ /_/ / / / / /|_/ / __/ / __ / /_/ // // / / / / __/ __/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
__ __
|
__ __
|
||||||
/ / / /___ ____ ___ ___ ____ ____ _____ ____
|
/ / / /___ ____ ___ ___ ____ ____ _____ ____
|
||||||
/ /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \
|
/ /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
____ ______ ____ ____
|
____ ______ ____ ____
|
||||||
/ _/_v4 / __/ /_ ___ __/ __ \/ __ )
|
/ _/_v4 / __/ /_ ___ __/ __ \/ __ )
|
||||||
/ // __ \/ /_/ / / / / |/_/ / / / __ |
|
/ // __ \/ /_/ / / / / |/_/ / / / __ |
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
_ ____ __
|
_ ____ __
|
||||||
(_)___ / __ )_________ / /_____ _____
|
(_)___ / __ )_________ / /_____ _____
|
||||||
/ / __ \/ __ / ___/ __ \/ //_/ _ \/ ___/
|
/ / __ \/ __ / ___/ __ \/ //_/ _ \/ ___/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${DGN}
|
echo -e "${DGN}
|
||||||
__________ ____ _____________ __
|
__________ ____ _____________ __
|
||||||
/ / ____/ / / /\ \/ / ____/ _/ | / /
|
/ / ____/ / / /\ \/ / ____/ _/ | / /
|
||||||
__ / / __/ / / / / \ / /_ / // |/ /
|
__ / / __/ / / / / \ / /_ / // |/ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
||||||
|
@ -98,131 +98,155 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
|
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
|
||||||
"18.04" "Bionic" OFF \
|
"18.04" "Bionic" OFF \
|
||||||
"20.04" "Focal" ON \
|
"20.04" "Focal" ON \
|
||||||
"21.10" "Impish" OFF \
|
"21.10" "Impish" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" OFF \
|
"1" "Unprivileged" OFF \
|
||||||
"0" "Privileged" ON \
|
"0" "Privileged" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -241,7 +265,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: c 226:0 rwm
|
lxc.cgroup2.devices.allow: c 226:0 rwm
|
||||||
lxc.cgroup2.devices.allow: c 226:128 rwm
|
lxc.cgroup2.devices.allow: c 226:128 rwm
|
||||||
lxc.cgroup2.devices.allow: c 29:0 rwm
|
lxc.cgroup2.devices.allow: c 29:0 rwm
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
__ __ __ __
|
__ __ __ __
|
||||||
/ //_/__ __ _______/ /___ ____ _/ /__
|
/ //_/__ __ _______/ /___ ____ _/ /__
|
||||||
/ ,< / _ \/ / / / ___/ / __ \/ __ / //_/
|
/ ,< / _ \/ / / / ___/ / __ \/ __ / //_/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ ___ _ __ ____
|
__ ___ _ __ ____
|
||||||
/ |/ /___ _____ _(_)____/ |/ (_)_____________ _____
|
/ |/ /___ _____ _(_)____/ |/ (_)_____________ _____
|
||||||
/ /|_/ / __ / __ / / ___/ /|_/ / / ___/ ___/ __ \/ ___/
|
/ /|_/ / __ / __ / / ___/ /|_/ / / ___/ ___/ __ \/ ___/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/mariadb-v4.sh
208
ct/mariadb-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ ___ _ ____ ____
|
__ ___ _ ____ ____
|
||||||
/ |/ /___ ______(_)___ _/ __ \/ __ )
|
/ |/ /___ ______(_)___ _/ __ \/ __ )
|
||||||
/ /|_/ / __ / ___/ / __ / / / / __ |
|
/ /|_/ / __ / ___/ / __ / / / / __ |
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ ___ __ ______ __ __
|
__ ___ __ ______ __ __
|
||||||
/ |/ /__ _____/ /_ / ____/__ ____ / /__________ _/ /
|
/ |/ /__ _____/ /_ / ____/__ ____ / /__________ _/ /
|
||||||
/ /|_/ / _ \/ ___/ __ \/ / / _ \/ __ \/ __/ ___/ __ / /
|
/ /|_/ / _ \/ ___/ __ \/ / / _ \/ __ \/ __/ ___/ __ / /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ ___ __ _ ________ ________
|
__ ___ __ _ ________ ________
|
||||||
/ |/ /___ / /_(_)___ ____ / ____/\ \/ / ____/
|
/ |/ /___ / /_(_)___ ____ / ____/\ \/ / ____/
|
||||||
/ /|_/ / __ \/ __/ / __ \/ __ \/ __/ \ / __/
|
/ /|_/ / __ \/ __/ / __ \/ __ \/ __/ \ / __/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/n8n-v4.sh
208
ct/n8n-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
___
|
___
|
||||||
/ _ \
|
/ _ \
|
||||||
_ __ | (_) |_v4_
|
_ __ | (_) |_v4_
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
_ __ _ __
|
_ __ _ __
|
||||||
/ | / /___ __ v4__(_)___/ /________ ____ ___ ___
|
/ | / /___ __ v4__(_)___/ /________ ____ ___ ___
|
||||||
/ |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \
|
/ |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
_ __ __ ________ ______ _
|
_ __ __ ________ ______ _
|
||||||
/ | / /__ _ __/ /_/ ____/ /___ __v4______/ / __ \(_)
|
/ | / /__ _ __/ /_/ ____/ /___ __v4______/ / __ \(_)
|
||||||
/ |/ / _ \| |/_/ __/ / / / __ \/ / / / __ / /_/ / /
|
/ |/ / _ \| |/_/ __/ / / / __ \/ / / / __ / /_/ / /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
_ __ _ ____ __ ___
|
_ __ _ ____ __ ___
|
||||||
/ | / /___ _(_)___ _ __ / __ \_________ _ ____ __ / |/ /___ _____ ____ _____ ____ _____
|
/ | / /___ _(_)___ _ __ / __ \_________ _ ____ __ / |/ /___ _____ ____ _____ ____ _____
|
||||||
/ |/ / __ / / __ \| |/_/ / /_/ / ___/ __ \| |/_/ / / / / /|_/ / __ / __ \/ __ / __ / _ \/ ___/
|
/ |/ / __ / / __ \| |/_/ / /_/ / ___/ __ \| |/_/ / / / / /|_/ / __ / __ \/ __ / __ / _ \/ ___/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/nocodb-v4.sh
208
ct/nocodb-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
_ __ ____ ____
|
_ __ ____ ____
|
||||||
/ | / /___ ____v4___ / __ \/ __ )
|
/ | / /___ ____v4___ / __ \/ __ )
|
||||||
/ |/ / __ \/ ___/ __ \/ / / / __ |
|
/ |/ / __ \/ ___/ __ \/ / / / __ |
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
_ __ __ ____ __
|
_ __ __ ____ __
|
||||||
/ | / /___ ____/ /__ v4 / __ \___ ____/ /
|
/ | / /___ ____/ /__ v4 / __ \___ ____/ /
|
||||||
/ |/ / __ \/ __ / _ \ / /_/ / _ \/ __ /
|
/ |/ / __ \/ __ / _ \ / /_/ / _ \/ __ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
224
ct/omada-v4.sh
224
ct/omada-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
____ __
|
____ __
|
||||||
/ __ \____ ___v4____ _____/ /___ _
|
/ __ \____ ___v4____ _____/ /___ _
|
||||||
/ / / / __ __ \/ __ / __ / __ /
|
/ / / / __ __ \/ __ / __ / __ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
||||||
|
@ -97,132 +97,156 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
||||||
"18.04" "Bionic" OFF \
|
"18.04" "Bionic" OFF \
|
||||||
"20.04" "Focal" ON \
|
"20.04" "Focal" ON \
|
||||||
"21.10" "Impish" OFF \
|
"21.10" "Impish" OFF \
|
||||||
"22.04" "Jammy" OFF \
|
"22.04" "Jammy" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
210
ct/omv-v4.sh
210
ct/omv-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
____ __ ___ ___ _ __ ____
|
____ __ ___ ___ _ __ ____
|
||||||
/ __ \____v4___ ____ / |/ /__ ____/ (_)___ | | / /___ ___ __/ / /_
|
/ __ \____v4___ ____ / |/ /__ ____/ (_)___ | | / /___ ___ __/ / /_
|
||||||
/ / / / __ \/ _ \/ __ \/ /|_/ / _ \/ __ / / __ `/ | / / __ `/ / / / / __/
|
/ / / / __ \/ _ \/ __ \/ /|_/ / _ \/ __ / / __ `/ | / / __ `/ / / / / __/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
|
208
ct/openhab-v4.sh
208
ct/openhab-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
__ _____ ____
|
__ _____ ____
|
||||||
____v4____ ___ ____ / / / / | / __ )
|
____v4____ ___ ____ / / / / | / __ )
|
||||||
/ __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
|
/ __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
____ __
|
____ __
|
||||||
/ __ \____ _____ ___ _____/ /__v4__________ ____ ____ __ __
|
/ __ \____ _____ ___ _____/ /__v4__________ ____ ____ __ __
|
||||||
/ /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/
|
/ /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
____ __ ______ __________ ____ ____ _________ __ ___
|
____ __ ______ __________ ____ ____ _________ __ ___
|
||||||
/ __ \/ / / / __ \/_ __/ __ \/ __ \/ __ \/ _/ ___// |/ /
|
/ __ \/ / / / __ \/_ __/ __ \/ __ \/ __ \/ _/ ___// |/ /
|
||||||
/ /_/ / /_/ / / / / / / / / / / /_/ / /_/ // / \__ \/ /|_/ /
|
/ /_/ / /_/ / / / / / / / / / / /_/ / /_/ // / \__ \/ /|_/ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/pihole-v4.sh
208
ct/pihole-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
____ ____ __ ______ __ ______
|
____ ____ __ ______ __ ______
|
||||||
/ __ \/ _/ / / / / __ \/ / / ____/
|
/ __ \/ _/ / / / / __ \/ / / ____/
|
||||||
/ /_/ // /___/ /_/ / / / / / / __/
|
/ /_/ // /___/ /_/ / / / / / / __/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
224
ct/plex-v4.sh
224
ct/plex-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
____ __
|
____ __
|
||||||
/ __ \/ /__ _ __
|
/ __ \/ /__ _ __
|
||||||
/ /_/ / / _ \| |/_/
|
/ /_/ / / _ \| |/_/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
||||||
|
@ -98,131 +98,155 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
|
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
|
||||||
"18.04" "Bionic" OFF \
|
"18.04" "Bionic" OFF \
|
||||||
"20.04" "Focal" ON \
|
"20.04" "Focal" ON \
|
||||||
"21.10" "Impish" OFF \
|
"21.10" "Impish" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" OFF \
|
"1" "Unprivileged" OFF \
|
||||||
"0" "Privileged" ON \
|
"0" "Privileged" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -241,7 +265,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: c 226:0 rwm
|
lxc.cgroup2.devices.allow: c 226:0 rwm
|
||||||
lxc.cgroup2.devices.allow: c 226:128 rwm
|
lxc.cgroup2.devices.allow: c 226:128 rwm
|
||||||
lxc.cgroup2.devices.allow: c 29:0 rwm
|
lxc.cgroup2.devices.allow: c 29:0 rwm
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
____ __
|
____ __
|
||||||
/ __ \____ ____/ /___ ___ ____ _____
|
/ __ \____ ____/ /___ ___ ____ _____
|
||||||
v4 / /_/ / __ \/ __ / __ __ \/ __ / __ \
|
v4 / /_/ / __ \/ __ / __ __ \/ __ / __ \
|
||||||
|
@ -65,12 +65,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
||||||
|
@ -100,124 +100,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -236,7 +260,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
____ __ _____ ____ __
|
____ __ _____ ____ __
|
||||||
/ __ \____ _____/ /_____ _________ / ___// __ \ / /
|
/ __ \____ _____/ /_____ _________ / ___// __ \ / /
|
||||||
/ /_/ / __ \/ ___/ __/ __ / ___/ _ \\__ \/ / / / / /
|
/ /_/ / __ \/ ___/ __/ __ / ___/ _ \\__ \/ / / / / /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
____ __ __
|
____ __ __
|
||||||
/ __ \_________ ____ ___ ___ / /_/ /_ ___ __ _______
|
/ __ \_________ ____ ___ ___ / /_/ /_ ___ __ _______
|
||||||
/ /_/ / ___/ __ \/ __ __ \/ _ \/ __/ __ \/ _ \/ / / / ___/
|
/ /_/ / ___/ __ \/ __ __ \/ _ \/ __/ __ \/ _ \/ / / / ___/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
_____ __ __ _
|
_____ __ __ _
|
||||||
/ ___/__ ______v4_____/ /_/ /_ (_)___ ____ _
|
/ ___/__ ______v4_____/ /_/ /_ (_)___ ____ _
|
||||||
\__ \/ / / / __ \/ ___/ __/ __ \/ / __ \/ __ `/
|
\__ \/ / / / __ \/ ___/ __/ __ \/ / __ \/ __ `/
|
||||||
|
@ -63,12 +63,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -98,124 +98,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
______ __ _ __ _ ____ _ _______
|
______ __ _ __ _ ____ _ _______
|
||||||
/_ __/__ _____/ /_ ____ (_) /_(_)_ ______ ___ v4 / __ \/ | / / ___/
|
/_ __/__ _____/ /_ ____ (_) /_(_)_ ______ ___ v4 / __ \/ | / / ___/
|
||||||
/ / / _ \/ ___/ __ \/ __ \/ / __/ / / / / __ __ \ / / / / |/ /\__ \
|
/ / / _ \/ ___/ __ \/ __ \/ / __/ / / / / __ __ \ / / / / |/ /\__ \
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/trilium-v4.sh
208
ct/trilium-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
______ _ ___
|
______ _ ___
|
||||||
/_ __/_v4_(_) (_)_ ______ ___
|
/_ __/_v4_(_) (_)_ ______ ___
|
||||||
/ / / ___/ / / / / / / __ `__ \
|
/ / / ___/ / / / / / / __ `__ \
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
224
ct/ubuntu-v4.sh
224
ct/ubuntu-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
__ ____ __
|
__ ____ __
|
||||||
/ / / / /_v4__ ______ / /___ __
|
/ / / / /_v4__ ______ / /___ __
|
||||||
/ / / / __ \/ / / / __ \/ __/ / / /
|
/ / / / __ \/ / / / __ \/ __/ / / /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
|
||||||
|
@ -97,132 +97,156 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
|
||||||
"18.04" "Bionic" OFF \
|
"18.04" "Bionic" OFF \
|
||||||
"20.04" "Focal" OFF \
|
"20.04" "Focal" OFF \
|
||||||
"21.10" "Impish" OFF \
|
"21.10" "Impish" OFF \
|
||||||
"22.04" "Jammy" ON \
|
"22.04" "Jammy" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}"; fi
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
210
ct/umbrel-v4.sh
210
ct/umbrel-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
__ __ __ __
|
__ __ __ __
|
||||||
/ / / /___ ___v4/ /_ ________ / /
|
/ / / /___ ___v4/ /_ ________ / /
|
||||||
/ / / / __ `__ \/ __ \/ ___/ _ \/ /
|
/ / / / __ `__ \/ __ \/ ___/ _ \/ /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
EOF
|
EOF
|
||||||
|
|
208
ct/unifi-v4.sh
208
ct/unifi-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ __ _ _____
|
__ __ _ _____
|
||||||
/ / / /_v4 (_) __(_)
|
/ / / /_v4 (_) __(_)
|
||||||
/ / / / __ \/ / /_/ /
|
/ / / / __ \/ / /_/ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${DGN}
|
echo -e "${DGN}
|
||||||
__ __ __ _ __ __
|
__ __ __ _ __ __
|
||||||
/ / / /___ / /_(_)___ ___ ___ v4 / //_/_ ______ ___ ____ _
|
/ / / /___ / /_(_)___ ___ ___ v4 / //_/_ ______ ___ ____ _
|
||||||
/ / / / __ \/ __/ / __ __ \/ _ \ / ,< / / / / __ __ \/ __ /
|
/ / / / __ \/ __/ / __ __ \/ _ \ / ,< / / / / __ __ \/ __ /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${CL}
|
echo -e "${CL}
|
||||||
_ _____ __ ____ _______ _____ ____ ____ _______ __
|
_ _____ __ ____ _______ _____ ____ ____ _______ __
|
||||||
| | / / | / / / / / /_ __/ | / / | / __ \/ __ \/ ____/ | / /
|
| | / / | / / / / / /_ __/ | / / | / __ \/ __ \/ ____/ | / /
|
||||||
| | / / /| |/ / / / / / / | | /| / / /| | / /_/ / / / / __/ / |/ /
|
| | / / /| |/ / / / / / / | | /| / / /| | / /_/ / / / / __/ / |/ /
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/whoogle-v4.sh
208
ct/whoogle-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${GN}
|
echo -e "${GN}
|
||||||
_ ____ ______ ____ ________ ______
|
_ ____ ______ ____ ________ ______
|
||||||
| | v4 / / / / / __ \/ __ \/ ____/ / / ____/
|
| | v4 / / / / / __ \/ __ \/ ____/ / / ____/
|
||||||
| | /| / / /_/ / / / / / / / / __/ / / __/
|
| | /| / / /_/ / / / / / / / / __/ / / __/
|
||||||
|
@ -61,12 +61,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -96,124 +96,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
208
ct/wikijs-v4.sh
208
ct/wikijs-v4.sh
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
_ ___ __ _ _
|
_ ___ __ _ _
|
||||||
| | / (_) /__(_) (_)____
|
| | / (_) /__(_) (_)____
|
||||||
| | /| / / / //_/ / / / ___/
|
| | /| / / / //_/ / / / ___/
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
__ ___ _____ _
|
__ ___ _____ _
|
||||||
\ \ / (_) / ____| | |
|
\ \ / (_) / ____| | |
|
||||||
\ \ /\ / / _ _ __ ___| | __ _ _ __ _ _ __ __| |
|
\ \ /\ / / _ _ __ ___| | __ _ _ __ _ _ __ __| |
|
||||||
|
@ -63,12 +63,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
|
||||||
|
@ -98,124 +98,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" ON \
|
"1" "Unprivileged" ON \
|
||||||
"0" "Privileged" OFF \
|
"0" "Privileged" OFF \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
_____ _ __ ___ __ _______ ____________
|
_____ _ __ ___ __ _______ ____________
|
||||||
/__ / (_)___ _/ /_ ___ ___ |__ \ / |/ / __ \/_ __/_ __/
|
/__ / (_)___ _/ /_ ___ ___ |__ \ / |/ / __ \/_ __/_ __/
|
||||||
/ / / / __ / __ \/ _ \/ _ \__/ // /|_/ / / / / / / / /
|
/ / / / __ / __ \/ _ \/ _ \__/ // /|_/ / / / / / / / /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" OFF \
|
"1" "Unprivileged" OFF \
|
||||||
"0" "Privileged" ON \
|
"0" "Privileged" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
|
|
@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
|
||||||
var_install="${NSAPP}-install"
|
var_install="${NSAPP}-install"
|
||||||
NEXTID=$(pvesh get /cluster/nextid)
|
NEXTID=$(pvesh get /cluster/nextid)
|
||||||
INTEGER='^[0-9]+$'
|
INTEGER='^[0-9]+$'
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -43,7 +43,7 @@ else
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
_____ _______ __ ______
|
_____ _______ __ ______
|
||||||
/__ /_ ______ __v4 _____ / / ___/ / / / / _/
|
/__ /_ ______ __v4 _____ / / ___/ / / / / _/
|
||||||
/ /| | /| / / __ `/ | / / _ \ __ / /\__ \ / / / // /
|
/ /| | /| / / __ `/ | / / _ \ __ / /\__ \ / / / // /
|
||||||
|
@ -62,12 +62,12 @@ function msg_ok() {
|
||||||
}
|
}
|
||||||
function PVE_CHECK() {
|
function PVE_CHECK() {
|
||||||
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
|
||||||
if [[ $PVE != 1 ]]; then
|
if [[ $PVE != 1 ]]; then
|
||||||
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
|
||||||
echo -e "Exiting..."
|
echo -e "Exiting..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function default_settings() {
|
function default_settings() {
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
|
||||||
|
@ -97,124 +97,148 @@ function default_settings() {
|
||||||
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
|
||||||
}
|
}
|
||||||
function advanced_settings() {
|
function advanced_settings() {
|
||||||
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \
|
||||||
"1" "Unprivileged" OFF \
|
"1" "Unprivileged" OFF \
|
||||||
"0" "Privileged" ON \
|
"0" "Privileged" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}"
|
||||||
fi
|
fi
|
||||||
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
|
if [ -z $PW1 ]; then
|
||||||
|
PW1="Automatic Login" PW=" "
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
else
|
else
|
||||||
PW="-password $PW1"
|
PW="-password $PW1"
|
||||||
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
|
if [ -z $CT_ID ]; then
|
||||||
else
|
CT_ID="$NEXTID"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi;
|
echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
|
||||||
fi
|
else
|
||||||
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
|
CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi;
|
if [ -z $CT_NAME ]; then
|
||||||
fi
|
HN="$NSAPP"
|
||||||
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}";
|
if [ $exitstatus = 0 ]; then
|
||||||
else
|
HN=$(echo ${CT_NAME,,} | tr -d ' ')
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi;
|
echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
|
||||||
if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
|
if [ -z $DISK_SIZE ]; then
|
||||||
else
|
DISK_SIZE="$var_disk"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi;
|
echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"
|
||||||
fi
|
else
|
||||||
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi
|
||||||
exitstatus=$?
|
if ! [[ $DISK_SIZE =~ $INTEGER ]]; then
|
||||||
if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
|
echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"
|
||||||
else
|
advanced_settings
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi;
|
fi
|
||||||
fi
|
fi
|
||||||
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
|
if [ -z $CORE_COUNT ]; then
|
||||||
else
|
CORE_COUNT="$var_cpu"
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
|
echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
|
||||||
fi
|
else
|
||||||
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi
|
||||||
exitstatus=$?
|
fi
|
||||||
if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
|
RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
else
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
|
if [ -z $RAM_SIZE ]; then
|
||||||
fi
|
RAM_SIZE="$var_ram"
|
||||||
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
|
||||||
exitstatus=$?
|
else
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi
|
||||||
if [ -z $GATE1 ]; then GATE1="Default" GATE="";
|
fi
|
||||||
|
BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $BRG ]; then
|
||||||
|
BRG="vmbr0"
|
||||||
|
echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
|
||||||
|
fi
|
||||||
|
NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ -z $NET ]; then
|
||||||
|
NET="dhcp"
|
||||||
|
echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
|
||||||
|
else
|
||||||
|
if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
|
||||||
|
fi
|
||||||
|
GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
|
exitstatus=$?
|
||||||
|
if [ $exitstatus = 0 ]; then
|
||||||
|
if [ -z $GATE1 ]; then
|
||||||
|
GATE1="Default" GATE=""
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
else
|
else
|
||||||
GATE=",gw=$GATE1"
|
GATE=",gw=$GATE1"
|
||||||
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $MAC1 ]; then MAC1="Default" MAC="";
|
if [ -z $MAC1 ]; then
|
||||||
|
MAC1="Default" MAC=""
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
else
|
else
|
||||||
MAC=",hwaddr=$MAC1"
|
MAC=",hwaddr=$MAC1"
|
||||||
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
|
||||||
exitstatus=$?
|
exitstatus=$?
|
||||||
if [ $exitstatus = 0 ]; then
|
if [ $exitstatus = 0 ]; then
|
||||||
if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
|
if [ -z $VLAN1 ]; then
|
||||||
|
VLAN1="Default" VLAN=""
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
else
|
else
|
||||||
VLAN=",tag=$VLAN1"
|
VLAN=",tag=$VLAN1"
|
||||||
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
|
||||||
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
echo -e "${RD}Creating a ${APP} LXC using the above advanced settings${CL}"
|
||||||
else
|
else
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function start_script() {
|
function start_script() {
|
||||||
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then
|
||||||
header_info
|
header_info
|
||||||
echo -e "${BL}Using Default Settings${CL}"
|
echo -e "${BL}Using Default Settings${CL}"
|
||||||
default_settings
|
default_settings
|
||||||
else
|
else
|
||||||
header_info
|
header_info
|
||||||
echo -e "${RD}Using Advanced Settings${CL}"
|
echo -e "${RD}Using Advanced Settings${CL}"
|
||||||
advanced_settings
|
advanced_settings
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
start_script
|
start_script
|
||||||
if [ "$CT_TYPE" == "1" ]; then
|
if [ "$CT_TYPE" == "1" ]; then
|
||||||
FEATURES="nesting=1,keyctl=1"
|
FEATURES="nesting=1,keyctl=1"
|
||||||
else
|
else
|
||||||
FEATURES="nesting=1"
|
FEATURES="nesting=1"
|
||||||
fi
|
fi
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
export CTID=$CT_ID
|
export CTID=$CT_ID
|
||||||
|
@ -233,7 +257,7 @@ export PCT_OPTIONS="
|
||||||
"
|
"
|
||||||
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >>$LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
lxc.cap.drop:
|
lxc.cap.drop:
|
||||||
lxc.cgroup2.devices.allow: c 188:* rwm
|
lxc.cgroup2.devices.allow: c 188:* rwm
|
||||||
|
|
|
@ -3,9 +3,9 @@ echo -e "\e[1;33mThis script will add Tailscale to an existing LXC Container ONL
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
|
read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ function msg() {
|
||||||
|
|
||||||
CTID=$1
|
CTID=$1
|
||||||
CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $CTID_CONFIG_PATH
|
cat <<EOF >>$CTID_CONFIG_PATH
|
||||||
lxc.cgroup2.devices.allow: c 10:200 rwm
|
lxc.cgroup2.devices.allow: c 10:200 rwm
|
||||||
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
|
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
IP=$(hostname -I | awk '{print $1}')
|
IP=$(hostname -I | awk '{print $1}')
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -32,14 +32,14 @@ function error_exit() {
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
______ __ _____
|
______ __ _____
|
||||||
/ ____/___ ____/ /__ / ___/___ ______ _____ _____
|
/ ____/___ ____/ /__ / ___/___ ______ _____ _____
|
||||||
/ / / __ \/ __ / _ \ \__ \/ _ \/ ___/ | / / _ \/ ___/
|
/ / / __ \/ __ / _ \ \__ \/ _ \/ ___/ | / / _ \/ ___/
|
||||||
|
@ -66,9 +66,9 @@ apt-get install -y sudo &>/dev/null
|
||||||
apt-get install -y git &>/dev/null
|
apt-get install -y git &>/dev/null
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest \
|
VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 3, length($2)-4) }') \
|
awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
|
||||||
msg_info "Installing Code-Server v${VERSION}"
|
msg_info "Installing Code-Server v${VERSION}"
|
||||||
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb &>/dev/null
|
curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb &>/dev/null
|
||||||
|
@ -76,7 +76,7 @@ sudo dpkg -i code-server_${VERSION}_amd64.deb &>/dev/null
|
||||||
rm -rf code-server_${VERSION}_amd64.deb
|
rm -rf code-server_${VERSION}_amd64.deb
|
||||||
mkdir -p ~/.config/code-server/
|
mkdir -p ~/.config/code-server/
|
||||||
sudo systemctl enable --now code-server@$USER &>/dev/null
|
sudo systemctl enable --now code-server@$USER &>/dev/null
|
||||||
cat <<EOF > ~/.config/code-server/config.yaml
|
cat <<EOF >~/.config/code-server/config.yaml
|
||||||
bind-addr: 0.0.0.0:8680
|
bind-addr: 0.0.0.0:8680
|
||||||
auth: none
|
auth: none
|
||||||
password:
|
password:
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
clear
|
clear
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -15,14 +15,14 @@ APP="Home Assistant Container"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
|
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
__ __ ___ _ __ __
|
__ __ ___ _ __ __
|
||||||
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_
|
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_
|
||||||
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/
|
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/
|
||||||
|
@ -46,10 +46,12 @@ function msg_error() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
||||||
}
|
}
|
||||||
if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then msg_error "No backups found! \n"; exit 1; fi
|
if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then
|
||||||
|
msg_error "No backups found! \n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
DIR=/var/lib/docker/volumes/hass_config/_data/restore
|
DIR=/var/lib/docker/volumes/hass_config/_data/restore
|
||||||
if [ -d "$DIR" ];
|
if [ -d "$DIR" ]; then
|
||||||
then
|
|
||||||
msg_ok "Restore Directory Exists."
|
msg_ok "Restore Directory Exists."
|
||||||
else
|
else
|
||||||
mkdir -p /var/lib/docker/volumes/hass_config/_data/restore
|
mkdir -p /var/lib/docker/volumes/hass_config/_data/restore
|
||||||
|
@ -58,7 +60,10 @@ fi
|
||||||
cd /var/lib/docker/volumes/hass_config/_data/backups/
|
cd /var/lib/docker/volumes/hass_config/_data/backups/
|
||||||
PS3="Please enter your choice: "
|
PS3="Please enter your choice: "
|
||||||
files="$(ls -A .)"
|
files="$(ls -A .)"
|
||||||
select filename in ${files}; do msg_ok "You selected ${BL}${filename}${CL}"; break; done
|
select filename in ${files}; do
|
||||||
|
msg_ok "You selected ${BL}${filename}${CL}"
|
||||||
|
break
|
||||||
|
done
|
||||||
msg_info "Stopping Home Assistant"
|
msg_info "Stopping Home Assistant"
|
||||||
docker stop homeassistant &>/dev/null
|
docker stop homeassistant &>/dev/null
|
||||||
msg_ok "Stopped Home Assistant"
|
msg_ok "Stopped Home Assistant"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
clear
|
clear
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -15,14 +15,14 @@ APP="Home Assistant Core"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
|
read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
__ __ ___ _ __ __ ______
|
__ __ ___ _ __ __ ______
|
||||||
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___ ________
|
/ / / /___ ____ ___ ___ / | __________(_)____/ /_____ _____ / /_ / ____/___ ________
|
||||||
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \
|
/ /_/ / __ \/ __ `__ \/ _ \ / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/ / / / __ \/ ___/ _ \
|
||||||
|
@ -46,10 +46,12 @@ function msg_error() {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
||||||
}
|
}
|
||||||
if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then msg_error "No backups found! \n"; exit 1; fi
|
if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then
|
||||||
|
msg_error "No backups found! \n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
DIR=/root/.homeassistant/restore
|
DIR=/root/.homeassistant/restore
|
||||||
if [ -d "$DIR" ];
|
if [ -d "$DIR" ]; then
|
||||||
then
|
|
||||||
msg_ok "Restore Directory Exists."
|
msg_ok "Restore Directory Exists."
|
||||||
else
|
else
|
||||||
mkdir -p /root/.homeassistant/restore
|
mkdir -p /root/.homeassistant/restore
|
||||||
|
@ -58,7 +60,10 @@ fi
|
||||||
cd /root/.homeassistant/backups/
|
cd /root/.homeassistant/backups/
|
||||||
PS3="Please enter your choice: "
|
PS3="Please enter your choice: "
|
||||||
files="$(ls -A .)"
|
files="$(ls -A .)"
|
||||||
select filename in ${files}; do msg_ok "You selected ${BL}${filename}${CL}"; break; done
|
select filename in ${files}; do
|
||||||
|
msg_ok "You selected ${BL}${filename}${CL}"
|
||||||
|
break
|
||||||
|
done
|
||||||
msg_info "Stopping Home Assistant"
|
msg_info "Stopping Home Assistant"
|
||||||
sudo service homeassistant stop
|
sudo service homeassistant stop
|
||||||
msg_ok "Stopped Home Assistant"
|
msg_ok "Stopped Home Assistant"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -31,14 +31,14 @@ function error_exit() {
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
_____ _ _____
|
_____ _ _____
|
||||||
/ ____| | |/ ____|
|
/ ____| | |/ ____|
|
||||||
| | _ __ _____ ____| | (___ ___ ___
|
| | _ __ _____ ____| | (___ ___ ___
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
clear
|
clear
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Dashy LXC. Proceed(y/n)?" yn
|
read -p "This will Update Dashy LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
_____ _
|
_____ _
|
||||||
| __ \ | |
|
| __ \ | |
|
||||||
| | | | __ _ ___| |__ _ _
|
| | | | __ _ ___| |__ _ _
|
||||||
|
|
|
@ -2,26 +2,26 @@
|
||||||
# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/edge-kernel.sh)"
|
# bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/edge-kernel.sh)"
|
||||||
set -e
|
set -e
|
||||||
KERNEL_ON=$(uname -r)
|
KERNEL_ON=$(uname -r)
|
||||||
PVE_KERNEL=$(dpkg --list| grep 'kernel-.*-pve' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
|
PVE_KERNEL=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
|
||||||
EDGE_KERNEL=$(dpkg --list| grep 'kernel-.*-edge' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
|
EDGE_KERNEL=$(dpkg --list | grep 'kernel-.*-edge' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
|
||||||
clear
|
clear
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This is a Proxmox Edge Kernel Tool, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
|
read -p "This is a Proxmox Edge Kernel Tool, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
|
|
||||||
show_menu(){
|
show_menu() {
|
||||||
normal=`echo "\033[m"`
|
normal=$(echo "\033[m")
|
||||||
safe=`echo "\033[32m"`
|
safe=$(echo "\033[32m")
|
||||||
menu=`echo "\033[36m"`
|
menu=$(echo "\033[36m")
|
||||||
number=`echo "\033[33m"`
|
number=$(echo "\033[33m")
|
||||||
bgred=`echo "\033[41m"`
|
bgred=$(echo "\033[41m")
|
||||||
fgred=`echo "\033[31m"`
|
fgred=$(echo "\033[31m")
|
||||||
proxmox-boot-tool kernel list
|
proxmox-boot-tool kernel list
|
||||||
echo -e "\nCurrent Kernel: ${menu}${KERNEL_ON}${normal}"
|
echo -e "\nCurrent Kernel: ${menu}${KERNEL_ON}${normal}"
|
||||||
printf "\n${menu}*********************************************${normal}\n"
|
printf "\n${menu}*********************************************${normal}\n"
|
||||||
|
@ -34,106 +34,113 @@ show_menu(){
|
||||||
printf "Please choose an option from the menu and enter or ${fgred}x${normal} to exit."
|
printf "Please choose an option from the menu and enter or ${fgred}x${normal} to exit."
|
||||||
read opt
|
read opt
|
||||||
}
|
}
|
||||||
option_picked(){
|
option_picked() {
|
||||||
msgcolor=`echo "\033[01;31m"`
|
msgcolor=$(echo "\033[01;31m")
|
||||||
normal=`echo "\033[00;00m"`
|
normal=$(echo "\033[00;00m")
|
||||||
message=${@:-"${normal}Error: No message passed"}
|
message=${@:-"${normal}Error: No message passed"}
|
||||||
printf "${msgcolor}${message}${normal}\n"
|
printf "${msgcolor}${message}${normal}\n"
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
while [ $opt != '' ]
|
while [ $opt != '' ]; do
|
||||||
do
|
|
||||||
if [ $opt = '' ]; then
|
if [ $opt = '' ]; then
|
||||||
exit;
|
exit
|
||||||
else
|
else
|
||||||
case $opt in
|
case $opt in
|
||||||
1) while true; do
|
1)
|
||||||
|
while true; do
|
||||||
read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
|
read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear;
|
clear
|
||||||
option_picked "Installing Proxmox Edge Kernel & Rebooting";
|
option_picked "Installing Proxmox Edge Kernel & Rebooting"
|
||||||
apt-get install -y gnupg
|
apt-get install -y gnupg
|
||||||
curl -1sLf 'https://dl.cloudsmith.io/public/pve-edge/kernel/gpg.8EC01CCF309B98E7.key' | apt-key add -
|
curl -1sLf 'https://dl.cloudsmith.io/public/pve-edge/kernel/gpg.8EC01CCF309B98E7.key' | apt-key add -
|
||||||
echo "deb https://dl.cloudsmith.io/public/pve-edge/kernel/deb/debian bullseye main" > /etc/apt/sources.list.d/pve-edge-kernel.list
|
echo "deb https://dl.cloudsmith.io/public/pve-edge/kernel/deb/debian bullseye main" >/etc/apt/sources.list.d/pve-edge-kernel.list
|
||||||
apt-get -y update
|
apt-get -y update
|
||||||
apt-get -y install pve-kernel-5.19-edge
|
apt-get -y install pve-kernel-5.19-edge
|
||||||
reboot
|
reboot
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
2) while true; do
|
2)
|
||||||
|
while true; do
|
||||||
read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn
|
read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear;
|
clear
|
||||||
option_picked "Switching to Proxmox VE 7 Kernel & Rebooting";
|
option_picked "Switching to Proxmox VE 7 Kernel & Rebooting"
|
||||||
proxmox-boot-tool kernel pin ${PVE_KERNEL}
|
proxmox-boot-tool kernel pin ${PVE_KERNEL}
|
||||||
reboot
|
reboot
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
3) while true; do
|
3)
|
||||||
|
while true; do
|
||||||
read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn
|
read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear;
|
clear
|
||||||
option_picked "Switching to Proxmox Edge Kernel & Rebooting";
|
option_picked "Switching to Proxmox Edge Kernel & Rebooting"
|
||||||
proxmox-boot-tool kernel pin ${EDGE_KERNEL}
|
proxmox-boot-tool kernel pin ${EDGE_KERNEL}
|
||||||
reboot
|
reboot
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
4) while true; do
|
4)
|
||||||
|
while true; do
|
||||||
read -p "Are you sure you want to Unpin the Current Kernel? Proceed(y/n)?" yn
|
read -p "Are you sure you want to Unpin the Current Kernel? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear;
|
clear
|
||||||
option_picked "Unpinning Current Kernel";
|
option_picked "Unpinning Current Kernel"
|
||||||
proxmox-boot-tool kernel unpin
|
proxmox-boot-tool kernel unpin
|
||||||
clear;
|
clear
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
5) while true; do
|
5)
|
||||||
|
while true; do
|
||||||
read -p "Are you sure you want to Remove Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
|
read -p "Are you sure you want to Remove Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear;
|
clear
|
||||||
option_picked "Removing Proxmox Edge Kernel & Rebooting";
|
option_picked "Removing Proxmox Edge Kernel & Rebooting"
|
||||||
apt-get purge -y ${EDGE_KERNEL}
|
apt-get purge -y ${EDGE_KERNEL}
|
||||||
rm -rf /etc/apt/sources.list.d/pve-edge-kernel.list
|
rm -rf /etc/apt/sources.list.d/pve-edge-kernel.list
|
||||||
proxmox-boot-tool kernel unpin
|
proxmox-boot-tool kernel unpin
|
||||||
reboot
|
reboot
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
x)exit;
|
x)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
\n)exit;
|
\n)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
*)clear;
|
*)
|
||||||
option_picked "Please choose an option from the menu";
|
clear
|
||||||
show_menu;
|
option_picked "Please choose an option from the menu"
|
||||||
|
show_menu
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
show_menu
|
show_menu
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
LATEST=$(curl -sL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
LATEST=$(curl -sL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -14,14 +14,14 @@ APP="Emby"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
|
read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
______ __
|
______ __
|
||||||
/ ____/___ ___ / /_ __ __
|
/ ____/___ ___ / /_ __ __
|
||||||
/ __/ / __ __ \/ __ \/ / / /
|
/ __/ / __ __ \/ __ \/ / / /
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
IP=$(hostname -I | awk '{print $1}')
|
IP=$(hostname -I | awk '{print $1}')
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -32,14 +32,14 @@ function error_exit() {
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${DGN}
|
echo -e "${DGN}
|
||||||
|
|
||||||
______ _ _ ____
|
______ _ _ ____
|
||||||
| ____(_) | | _ \
|
| ____(_) | | _ \
|
||||||
|
@ -81,7 +81,7 @@ WorkingDirectory=/root/
|
||||||
ExecStart=/usr/local/bin/filebrowser -r /
|
ExecStart=/usr/local/bin/filebrowser -r /
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target" > $service_path
|
WantedBy=default.target" >$service_path
|
||||||
|
|
||||||
systemctl enable --now filebrowser.service &>/dev/null
|
systemctl enable --now filebrowser.service &>/dev/null
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
|
@ -3,9 +3,9 @@ echo -e "\e[1;33m This script will Prepare a LXC Container for Frigate \e[0m"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Did you replace 106 with your LXC ID? Proceed (y/n)?" yn
|
read -p "Did you replace 106 with your LXC ID? Proceed (y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -48,7 +48,7 @@ for char_dev in ${CHAR_DEVS[@]}; do
|
||||||
CHAR_DEV_STRING+=" -regex \".*/${char_dev}\""
|
CHAR_DEV_STRING+=" -regex \".*/${char_dev}\""
|
||||||
done
|
done
|
||||||
|
|
||||||
read -r -d '' HOOK_SCRIPT <<- EOF || true
|
read -r -d '' HOOK_SCRIPT <<-EOF || true
|
||||||
for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do
|
for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do
|
||||||
dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)";
|
dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)";
|
||||||
mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev});
|
mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev});
|
||||||
|
@ -66,7 +66,7 @@ CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
||||||
sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf
|
sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf
|
||||||
cat CTID.conf >$CTID_CONFIG_PATH
|
cat CTID.conf >$CTID_CONFIG_PATH
|
||||||
|
|
||||||
cat <<EOF >> $CTID_CONFIG_PATH
|
cat <<EOF >>$CTID_CONFIG_PATH
|
||||||
lxc.autodev: 1
|
lxc.autodev: 1
|
||||||
lxc.hook.autodev: bash -c '$HOOK_SCRIPT'
|
lxc.hook.autodev: bash -c '$HOOK_SCRIPT'
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn
|
read -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -58,7 +58,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -73,13 +73,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.02.12" 13 50 || exit
|
Version: 2022.02.12" 13 50 || exit
|
||||||
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -90,13 +90,13 @@ fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
||||||
PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/
|
PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_FROM' not found."
|
die "Home Assistant directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${PODMAN_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${PODMAN_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_TO' not found."
|
die "Home Assistant directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
rm -rf ${CTID_TO_PATH}${PODMAN_PATH}
|
rm -rf ${CTID_TO_PATH}${PODMAN_PATH}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn
|
read -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -58,7 +58,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -73,13 +73,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.01.23" 13 50 || exit
|
Version: 2022.01.23" 13 50 || exit
|
||||||
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -89,13 +89,13 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then
|
||||||
fi
|
fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_FROM' not found."
|
die "Home Assistant directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_TO' not found."
|
die "Home Assistant directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
rm -rf ${CTID_TO_PATH}${DOCKER_PATH}
|
rm -rf ${CTID_TO_PATH}${DOCKER_PATH}
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
|
read -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -55,7 +55,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -70,13 +70,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.10.02" 13 50 || exit
|
Version: 2022.10.02" 13 50 || exit
|
||||||
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -87,13 +87,13 @@ fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
|
DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
|
||||||
CORE_PATH=/root/.homeassistant
|
CORE_PATH=/root/.homeassistant
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_FROM' not found."
|
die "Home Assistant directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${CORE_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${CORE_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_TO' not found."
|
die "Home Assistant directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
msg "Copying Data..."
|
msg "Copying Data..."
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn
|
read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -55,7 +55,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -70,13 +70,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.10.02" 13 50 || exit
|
Version: 2022.10.02" 13 50 || exit
|
||||||
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -87,13 +87,13 @@ fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
|
DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
|
||||||
CORE_PATH=/root/.homeassistant
|
CORE_PATH=/root/.homeassistant
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_FROM' not found."
|
die "Home Assistant directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_TO' not found."
|
die "Home Assistant directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
msg "Copying Data..."
|
msg "Copying Data..."
|
||||||
|
|
|
@ -3,9 +3,9 @@ clear
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
|
read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -51,7 +51,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -66,13 +66,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.10.03" 13 50 || exit
|
Version: 2022.10.03" 13 50 || exit
|
||||||
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -83,13 +83,13 @@ fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
|
DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
|
||||||
CORE_PATH=/root/.homeassistant
|
CORE_PATH=/root/.homeassistant
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_FROM' not found."
|
die "Home Assistant directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${CORE_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${CORE_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_TO' not found."
|
die "Home Assistant directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
msg "Copying Data..."
|
msg "Copying Data..."
|
||||||
|
|
|
@ -4,9 +4,9 @@ echo -e "\e[1;33m This script will install Home Assistant Community Store (HACS)
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Start the HACS Install Script (y/n)?" yn
|
read -p "Start the HACS Install Script (y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@ echo -e "\e[1;33m This script will install Home Assistant Community Store (HACS)
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Start the HACS Install Script (y/n)?" yn
|
read -p "Start the HACS Install Script (y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
PP=`echo "\e[1;35m"`
|
PP=$(echo "\e[1;35m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Heimdall Dashboard. Proceed(y/n)?" yn
|
read -p "This will Update Heimdall Dashboard. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${PP}
|
echo -e "${PP}
|
||||||
_ _ _ _ _ _ _____ _ _ _
|
_ _ _ _ _ _ _____ _ _ _
|
||||||
| | | | (_) | | | | | | __ \ | | | | | |
|
| | | | (_) | | | | | | __ \ | | | | | |
|
||||||
| |__| | ___ _ _ __ ___ __| | __ _| | | | | | | __ _ ___| |__ | |__ ___ __ _ _ __ __| |
|
| |__| | ___ _ _ __ ___ __| | __ _| | | | | | | __ _ ___| |__ | |__ ___ __ _ _ __ __| |
|
||||||
|
@ -39,13 +39,13 @@ echo -en "${GN} Backing up Data... "
|
||||||
if [ -d "/opt/Heimdall-2.4.6" ]; then
|
if [ -d "/opt/Heimdall-2.4.6" ]; then
|
||||||
cp -R /opt/Heimdall-2.4.6/database database-backup
|
cp -R /opt/Heimdall-2.4.6/database database-backup
|
||||||
cp -R /opt/Heimdall-2.4.6/public public-backup
|
cp -R /opt/Heimdall-2.4.6/public public-backup
|
||||||
elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
|
elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
|
||||||
cp -R /opt/Heimdall-2.4.7b/database database-backup
|
cp -R /opt/Heimdall-2.4.7b/database database-backup
|
||||||
cp -R /opt/Heimdall-2.4.7b/public public-backup
|
cp -R /opt/Heimdall-2.4.7b/public public-backup
|
||||||
elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
|
elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
|
||||||
cp -R /opt/Heimdall-2.4.8/database database-backup
|
cp -R /opt/Heimdall-2.4.8/database database-backup
|
||||||
cp -R /opt/Heimdall-2.4.8/public public-backup
|
cp -R /opt/Heimdall-2.4.8/public public-backup
|
||||||
else
|
else
|
||||||
cp -R /opt/Heimdall/database database-backup
|
cp -R /opt/Heimdall/database database-backup
|
||||||
cp -R /opt/Heimdall/public public-backup
|
cp -R /opt/Heimdall/public public-backup
|
||||||
fi
|
fi
|
||||||
|
@ -56,13 +56,13 @@ RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/releas
|
||||||
echo -en "${GN} Updating Heimdall Dashboard to ${RELEASE}... "
|
echo -en "${GN} Updating Heimdall Dashboard to ${RELEASE}... "
|
||||||
curl --silent -o ${RELEASE}.tar.gz -L "https://github.com/linuxserver/Heimdall/archive/${RELEASE}.tar.gz" &>/dev/null
|
curl --silent -o ${RELEASE}.tar.gz -L "https://github.com/linuxserver/Heimdall/archive/${RELEASE}.tar.gz" &>/dev/null
|
||||||
tar xvzf ${RELEASE}.tar.gz &>/dev/null
|
tar xvzf ${RELEASE}.tar.gz &>/dev/null
|
||||||
VER=$(curl -s https://api.github.com/repos/linuxserver/Heimdall/releases/latest \
|
VER=$(curl -s https://api.github.com/repos/linuxserver/Heimdall/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 3, length($2)-4) }')
|
awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
|
||||||
if [ ! -d "/opt/Heimdall" ]; then
|
if [ ! -d "/opt/Heimdall" ]; then
|
||||||
mv Heimdall-${VER} /opt/Heimdall
|
mv Heimdall-${VER} /opt/Heimdall
|
||||||
else
|
else
|
||||||
cp -R Heimdall-${VER}/* /opt/Heimdall
|
cp -R Heimdall-${VER}/* /opt/Heimdall
|
||||||
fi
|
fi
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
|
@ -82,7 +82,7 @@ ExecStart="/usr/bin/php" artisan serve --port 7990 --host 0.0.0.0
|
||||||
TimeoutStopSec=30
|
TimeoutStopSec=30
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target" > $service_path
|
WantedBy=multi-user.target" >$service_path
|
||||||
|
|
||||||
echo -en "${GN} Restoring Data... "
|
echo -en "${GN} Restoring Data... "
|
||||||
cp -R database-backup/* /opt/Heimdall/database
|
cp -R database-backup/* /opt/Heimdall/database
|
||||||
|
@ -94,10 +94,10 @@ echo -en "${GN} Cleanup... "
|
||||||
if [ -d "/opt/Heimdall-2.4.6" ]; then
|
if [ -d "/opt/Heimdall-2.4.6" ]; then
|
||||||
rm -rf /opt/Heimdall-2.4.6
|
rm -rf /opt/Heimdall-2.4.6
|
||||||
rm -rf /opt/v2.4.6.tar.gz
|
rm -rf /opt/v2.4.6.tar.gz
|
||||||
elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
|
elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
|
||||||
rm -rf /opt/Heimdall-2.4.7b
|
rm -rf /opt/Heimdall-2.4.7b
|
||||||
rm -rf /opt/v2.4.7b.tar.gz
|
rm -rf /opt/v2.4.7b.tar.gz
|
||||||
elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
|
elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
|
||||||
rm -rf /opt/Heimdall-2.4.8
|
rm -rf /opt/Heimdall-2.4.8
|
||||||
rm -rf /opt/v2.4.8.tar.gz
|
rm -rf /opt/v2.4.8.tar.gz
|
||||||
fi
|
fi
|
||||||
|
@ -116,4 +116,3 @@ sleep 2
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
|
|
||||||
echo -en "${GN} Finished! ${CL}\n"
|
echo -en "${GN} Finished! ${CL}\n"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -30,14 +30,14 @@ function error_exit() {
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update ${APP}. Proceed(y/n)?" yn
|
read -p "This will Update ${APP}. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
__ __
|
__ __
|
||||||
/ / / /___ ____ ___ ___ ____ ____ _____ ____
|
/ / / /___ ____ ___ ___ ____ ____ _____ ____
|
||||||
/ /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \
|
/ /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash -ex
|
#!/usr/bin/env bash -ex
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
shopt -s inherit_errexit nullglob
|
shopt -s inherit_errexit nullglob
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -18,15 +18,15 @@ current_kernel=$(uname -r)
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
|
read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo -e "${RD}Please answer y/n${CL}";;
|
*) echo -e "${RD}Please answer y/n${CL}" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
|
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
_ __ _ _____ _
|
_ __ _ _____ _
|
||||||
| |/ / | | / ____| |
|
| |/ / | | / ____| |
|
||||||
| / ___ _ __ _ __ ___| | | | | | ___ __ _ _ __
|
| / ___ _ __ _ __ ___| | | | | | ___ __ _ _ __
|
||||||
|
@ -80,10 +80,9 @@ function kernel_info() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function kernel_clean() {
|
function kernel_clean() {
|
||||||
kernels=$(dpkg --list| grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
|
kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
|
||||||
remove_kernels=""
|
remove_kernels=""
|
||||||
for kernel in $kernels
|
for kernel in $kernels; do
|
||||||
do
|
|
||||||
if [ "$(echo $kernel | grep $current_kernel)" ]; then
|
if [ "$(echo $kernel | grep $current_kernel)" ]; then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
@ -91,7 +90,7 @@ function kernel_clean() {
|
||||||
remove_kernels+=" $kernel"
|
remove_kernels+=" $kernel"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
msg_ok "Kernel Search Completed\n"
|
msg_ok "Kernel Search Completed\n"
|
||||||
if [[ "$remove_kernels" != *"pve"* ]]; then
|
if [[ "$remove_kernels" != *"pve"* ]]; then
|
||||||
echo -e "${PARTY} ${GN}It appears there are no old Kernels on your system. \n${CL}"
|
echo -e "${PARTY} ${GN}It appears there are no old Kernels on your system. \n${CL}"
|
||||||
msg_info "Exiting"
|
msg_info "Exiting"
|
||||||
|
@ -102,10 +101,10 @@ msg_ok "Kernel Search Completed\n"
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
|
msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
|
||||||
/usr/bin/apt purge -y $remove_kernels > /dev/null 2>&1
|
/usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1
|
||||||
msg_ok "Successfully Removed Kernels"
|
msg_ok "Successfully Removed Kernels"
|
||||||
msg_info "Updating GRUB"
|
msg_info "Updating GRUB"
|
||||||
/usr/sbin/update-grub > /dev/null 2>&1
|
/usr/sbin/update-grub >/dev/null 2>&1
|
||||||
msg_ok "Successfully Updated GRUB"
|
msg_ok "Successfully Updated GRUB"
|
||||||
msg_info "Exiting"
|
msg_info "Exiting"
|
||||||
sleep 2
|
sleep 2
|
||||||
|
@ -122,7 +121,7 @@ if ! command -v pveversion >/dev/null 2>&1; then
|
||||||
echo -e " Switching to PBS mode"
|
echo -e " Switching to PBS mode"
|
||||||
MODE="PBS"
|
MODE="PBS"
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
MODE="PVE"
|
MODE="PVE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will create a New Update Menu for Home Assistant Container LXC. Proceed(y/n)?" yn
|
read -p "This will create a New Update Menu for Home Assistant Container LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
|
@ -13,19 +13,19 @@ set -o errexit
|
||||||
rm -rf /root/update.sh update update-containers.sh
|
rm -rf /root/update.sh update update-containers.sh
|
||||||
echo -e "\e[1;92m Creating New Update Menu Script... \e[0m"
|
echo -e "\e[1;92m Creating New Update Menu Script... \e[0m"
|
||||||
if [ -f /usr/local/lib/python3.9/dist-packages/runlike/runlike.py ]; then
|
if [ -f /usr/local/lib/python3.9/dist-packages/runlike/runlike.py ]; then
|
||||||
echo -e "\e[1;92m pip3/runlike Already Installed! \e[0m"
|
echo -e "\e[1;92m pip3/runlike Already Installed! \e[0m"
|
||||||
else
|
else
|
||||||
apt-get update &>/dev/null
|
apt-get update &>/dev/null
|
||||||
echo -e "\e[1;92m Installing pip3... \e[0m"
|
echo -e "\e[1;92m Installing pip3... \e[0m"
|
||||||
apt-get install -y python3-pip &>/dev/null
|
apt-get install -y python3-pip &>/dev/null
|
||||||
echo -e "\e[1;92m Installing runlike... \e[0m"
|
echo -e "\e[1;92m Installing runlike... \e[0m"
|
||||||
pip3 install runlike &>/dev/null
|
pip3 install runlike &>/dev/null
|
||||||
fi
|
fi
|
||||||
echo -e "\e[1;92m Creating Update Script... \e[0m"
|
echo -e "\e[1;92m Creating Update Script... \e[0m"
|
||||||
if [ -d /root/hass_config ]; then
|
if [ -d /root/hass_config ]; then
|
||||||
echo -e "\e[1;92m There's Already (hass_config) Folder! \e[0m"
|
echo -e "\e[1;92m There's Already (hass_config) Folder! \e[0m"
|
||||||
else
|
else
|
||||||
mkdir /root/hass_config
|
mkdir /root/hass_config
|
||||||
fi
|
fi
|
||||||
UPDATE_PATH='/root/update'
|
UPDATE_PATH='/root/update'
|
||||||
UPDATE_CONTAINERS_PATH='/root/update-containers.sh'
|
UPDATE_CONTAINERS_PATH='/root/update-containers.sh'
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest \
|
RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 3, length($2)-4) }')
|
awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
function update_info {
|
function update_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
_ __ _ __
|
_ __ _ __
|
||||||
/ | / /___ __ __(_)___/ /________ ____ ___ ___
|
/ | / /___ __ __(_)___/ /________ ____ ___ ___
|
||||||
/ |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \
|
/ |/ / __ / | / / / __ / ___/ __ \/ __ __ \/ _ \
|
||||||
|
@ -23,9 +23,9 @@ update_info
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Navidrome to v$RELEASE. Proceed(y/n)?" yn
|
read -p "This will Update Navidrome to v$RELEASE. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -30,14 +30,14 @@ function error_exit() {
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update ${APP}. Proceed(y/n)?" yn
|
read -p "This will Update ${APP}. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${YW}
|
echo -e "${YW}
|
||||||
_ _ _____ ____
|
_ _ _____ ____
|
||||||
| \ | | | __ \| _ \
|
| \ | | | __ \| _ \
|
||||||
| \| | ___ v3___ ___ | | | | |_) |
|
| \| | ___ v3___ ___ | | | | |_) |
|
||||||
|
@ -68,18 +68,17 @@ msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
read -p "${APP} LXC needs to reboot to apply the update. Reboot now? " -n 1 -r
|
read -p "${APP} LXC needs to reboot to apply the update. Reboot now? " -n 1 -r
|
||||||
echo
|
echo
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
then
|
|
||||||
reboot=yes
|
reboot=yes
|
||||||
else
|
else
|
||||||
reboot=no
|
reboot=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$reboot" == "yes" ]; then
|
if [ "$reboot" == "yes" ]; then
|
||||||
msg_info "Rebooting ${APP} LXC"
|
msg_info "Rebooting ${APP} LXC"
|
||||||
reboot
|
reboot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$reboot" == "no" ]; then
|
if [ "$reboot" == "no" ]; then
|
||||||
msg_ok "Finished Updating ${APP}. Reboot to apply the update."
|
msg_ok "Finished Updating ${APP}. Reboot to apply the update."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/node-red-themes.sh)"
|
# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/node-red-themes.sh)"
|
||||||
set -o errexit
|
set -o errexit
|
||||||
show_menu(){
|
show_menu() {
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
echo -e "${RD} Backup your Node-Red flows before running this script!!${CL} \n "
|
echo -e "${RD} Backup your Node-Red flows before running this script!!${CL} \n "
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Install Node-Red Themes. Proceed(y/n)?" yn
|
read -p "This will Install Node-Red Themes. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
echo -e "${RD} Backup your Node-Red flows before installing any theme!!${CL} \n "
|
echo -e "${RD} Backup your Node-Red flows before installing any theme!!${CL} \n "
|
||||||
printf "\n${BL}*********************************************${CL}\n"
|
printf "\n${BL}*********************************************${CL}\n"
|
||||||
printf "${BL}**${YW} 1)${GN} Default Theme ${CL}\n"
|
printf "${BL}**${YW} 1)${GN} Default Theme ${CL}\n"
|
||||||
printf "${BL}**${YW} 2)${GN} Dark Theme ${CL}\n"
|
printf "${BL}**${YW} 2)${GN} Dark Theme ${CL}\n"
|
||||||
|
@ -32,75 +32,84 @@ echo -e "${RD} Backup your Node-Red flows before installing any theme!!${CL} \n
|
||||||
read opt
|
read opt
|
||||||
}
|
}
|
||||||
|
|
||||||
option_picked(){
|
option_picked() {
|
||||||
msgcolor=`echo "\033[01;31m"`
|
msgcolor=$(echo "\033[01;31m")
|
||||||
normal=`echo "\033[00;00m"`
|
normal=$(echo "\033[00;00m")
|
||||||
message=${@:-"${CL}Error: No message passed"}
|
message=${@:-"${CL}Error: No message passed"}
|
||||||
printf "${RD}${message}${CL}\n"
|
printf "${RD}${message}${CL}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
while [ "$opt" != " " ]
|
while [ "$opt" != " " ]; do
|
||||||
do
|
|
||||||
case $opt in
|
case $opt in
|
||||||
1) clear;
|
1)
|
||||||
option_picked "Installing Default Theme";
|
clear
|
||||||
|
option_picked "Installing Default Theme"
|
||||||
THEME=
|
THEME=
|
||||||
JS=//
|
JS=//
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
2) clear;
|
2)
|
||||||
option_picked "Installing Dark Theme";
|
clear
|
||||||
|
option_picked "Installing Dark Theme"
|
||||||
THEME=dark
|
THEME=dark
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
3) clear;
|
3)
|
||||||
option_picked "Installing Dracula Theme";
|
clear
|
||||||
|
option_picked "Installing Dracula Theme"
|
||||||
THEME=dracula
|
THEME=dracula
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
4) clear;
|
4)
|
||||||
option_picked "Installing Midnight-Red Theme";
|
clear
|
||||||
|
option_picked "Installing Midnight-Red Theme"
|
||||||
THEME=midnight-red
|
THEME=midnight-red
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
5) clear;
|
5)
|
||||||
option_picked "Installing Oled Theme";
|
clear
|
||||||
|
option_picked "Installing Oled Theme"
|
||||||
THEME=oled
|
THEME=oled
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
6) clear;
|
6)
|
||||||
option_picked "Installing Solarized-Dark Theme";
|
clear
|
||||||
|
option_picked "Installing Solarized-Dark Theme"
|
||||||
THEME=solarized-dark
|
THEME=solarized-dark
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
7) clear;
|
7)
|
||||||
option_picked "Installing Solarized-Light Theme";
|
clear
|
||||||
|
option_picked "Installing Solarized-Light Theme"
|
||||||
THEME=solarized-light
|
THEME=solarized-light
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
x)exit;
|
x)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
\n)exit;
|
\n)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
*)clear;
|
*)
|
||||||
option_picked "Please choose a theme from the menu";
|
clear
|
||||||
show_menu;
|
option_picked "Please choose a theme from the menu"
|
||||||
|
show_menu
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
echo -en "${GN} Installing ${THEME} Theme... "
|
echo -en "${GN} Installing ${THEME} Theme... "
|
||||||
cd /root/.node-red
|
cd /root/.node-red
|
||||||
if [ "${THEME}" = "" ]; then
|
if [ "${THEME}" = "" ]; then
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
else
|
else
|
||||||
npm install @node-red-contrib-themes/${THEME} &>/dev/null
|
npm install @node-red-contrib-themes/${THEME} &>/dev/null
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
fi
|
fi
|
||||||
echo -en "${GN} Writing Settings... "
|
echo -en "${GN} Writing Settings... "
|
||||||
cat <<EOF > /root/.node-red/settings.js
|
cat <<EOF >/root/.node-red/settings.js
|
||||||
module.exports = { uiPort: process.env.PORT || 1880,
|
module.exports = { uiPort: process.env.PORT || 1880,
|
||||||
mqttReconnectTime: 15000,
|
mqttReconnectTime: 15000,
|
||||||
serialReconnectTime: 15000,
|
serialReconnectTime: 15000,
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest \
|
RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 3, length($2)-4) }') \
|
awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
|
|
||||||
function update_info {
|
function update_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
_ _ _____ __ __
|
_ _ _____ __ __
|
||||||
| \ | | | __ \ | \/ |
|
| \ | | | __ \ | \/ |
|
||||||
| \| | | |__) | | \ / |
|
| \| | | |__) | | \ / |
|
||||||
|
@ -26,9 +26,9 @@ update_info
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will update Nginx Proxy Manager to v${RELEASE}. Proceed(y/n)?" yn
|
read -p "This will update Nginx Proxy Manager to v${RELEASE}. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
|
@ -57,15 +57,15 @@ function msg() {
|
||||||
T="$(date +%M)"
|
T="$(date +%M)"
|
||||||
|
|
||||||
if [ -f /lib/systemd/system/npm.service ]; then
|
if [ -f /lib/systemd/system/npm.service ]; then
|
||||||
echo -en "${GN} Prep For Update... "
|
echo -en "${GN} Prep For Update... "
|
||||||
sleep 2
|
sleep 2
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
echo -en "${GN} Stopping Services... "
|
echo -en "${GN} Stopping Services... "
|
||||||
systemctl stop openresty
|
systemctl stop openresty
|
||||||
systemctl stop npm
|
systemctl stop npm
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
|
|
||||||
echo -en "${GN} Cleaning Old Files... "
|
echo -en "${GN} Cleaning Old Files... "
|
||||||
rm -rf /app \
|
rm -rf /app \
|
||||||
/var/www/html \
|
/var/www/html \
|
||||||
/etc/nginx \
|
/etc/nginx \
|
||||||
|
@ -73,7 +73,7 @@ echo -en "${GN} Cleaning Old Files... "
|
||||||
/var/lib/nginx \
|
/var/lib/nginx \
|
||||||
/var/cache/nginx &>/dev/null
|
/var/cache/nginx &>/dev/null
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
else
|
else
|
||||||
echo -en "${RD} No NPM to Update! ${CL}"
|
echo -en "${RD} No NPM to Update! ${CL}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -103,24 +103,24 @@ cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-prox
|
||||||
ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
|
ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
|
||||||
rm -f /etc/nginx/conf.d/dev.conf
|
rm -f /etc/nginx/conf.d/dev.conf
|
||||||
mkdir -p /tmp/nginx/body \
|
mkdir -p /tmp/nginx/body \
|
||||||
/run/nginx \
|
/run/nginx \
|
||||||
/data/nginx \
|
/data/nginx \
|
||||||
/data/custom_ssl \
|
/data/custom_ssl \
|
||||||
/data/logs \
|
/data/logs \
|
||||||
/data/access \
|
/data/access \
|
||||||
/data/nginx/default_host \
|
/data/nginx/default_host \
|
||||||
/data/nginx/default_www \
|
/data/nginx/default_www \
|
||||||
/data/nginx/proxy_host \
|
/data/nginx/proxy_host \
|
||||||
/data/nginx/redirection_host \
|
/data/nginx/redirection_host \
|
||||||
/data/nginx/stream \
|
/data/nginx/stream \
|
||||||
/data/nginx/dead_host \
|
/data/nginx/dead_host \
|
||||||
/data/nginx/temp \
|
/data/nginx/temp \
|
||||||
/var/lib/nginx/cache/public \
|
/var/lib/nginx/cache/public \
|
||||||
/var/lib/nginx/cache/private \
|
/var/lib/nginx/cache/private \
|
||||||
/var/cache/nginx/proxy_temp
|
/var/cache/nginx/proxy_temp
|
||||||
chmod -R 777 /var/cache/nginx
|
chmod -R 777 /var/cache/nginx
|
||||||
chown root /tmp/nginx
|
chown root /tmp/nginx
|
||||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" > /etc/nginx/conf.d/include/resolvers.conf
|
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
|
|
||||||
if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
|
if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
|
||||||
|
@ -144,7 +144,7 @@ echo -e "${CM}${CL} \r"
|
||||||
echo -en "${GN} Initializing Backend... "
|
echo -en "${GN} Initializing Backend... "
|
||||||
rm -rf /app/config/default.json &>/dev/null
|
rm -rf /app/config/default.json &>/dev/null
|
||||||
if [ ! -f /app/config/production.json ]; then
|
if [ ! -f /app/config/production.json ]; then
|
||||||
cat << 'EOF' > /app/config/production.json
|
cat <<'EOF' >/app/config/production.json
|
||||||
{
|
{
|
||||||
"database": {
|
"database": {
|
||||||
"engine": "knex-native",
|
"engine": "knex-native",
|
||||||
|
@ -168,7 +168,7 @@ systemctl enable npm &>/dev/null
|
||||||
systemctl start openresty
|
systemctl start openresty
|
||||||
systemctl start npm
|
systemctl start npm
|
||||||
echo -e "${CM}${CL} \r"
|
echo -e "${CM}${CL} \r"
|
||||||
TS="$(($(date +%M)-T))"
|
TS="$(($(date +%M) - T))"
|
||||||
|
|
||||||
IP=$(hostname -I | cut -f1 -d ' ')
|
IP=$(hostname -I | cut -f1 -d ' ')
|
||||||
echo -e "${GN}Successfully Updated Nginx Proxy Manager to ${RD}${RELEASE}${CL} and it took ${RD}${TS} minutes.${CL}
|
echo -e "${GN}Successfully Updated Nginx Proxy Manager to ${RD}${RELEASE}${CL} and it took ${RD}${TS} minutes.${CL}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
clear
|
clear
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
RETRY_NUM=10
|
RETRY_NUM=10
|
||||||
RETRY_EVERY=3
|
RETRY_EVERY=3
|
||||||
NUM=$RETRY_NUM
|
NUM=$RETRY_NUM
|
||||||
|
@ -30,7 +30,7 @@ function msg_error() {
|
||||||
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
____ __
|
____ __
|
||||||
/ __ \____ _____ ___ _____/ /__ __________ ____ ____ __ __
|
/ __ \____ _____ ___ _____/ /__ __________ ____ ____ __ __
|
||||||
/ /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/
|
/ /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/
|
||||||
|
@ -42,9 +42,9 @@ EOF
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Paperless-ngx to $RELEASE. Proceed(y/n)?" yn
|
read -p "This will Update Paperless-ngx to $RELEASE. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/photoprism/photoprism/releases/latest \
|
RELEASE=$(curl -s https://api.github.com/repos/photoprism/photoprism/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 2, length($2)-4) }') \
|
awk '{print substr($2, 2, length($2)-4) }')
|
||||||
|
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
PP=`echo "\e[1;35m"`
|
PP=$(echo "\e[1;35m")
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Update PhotoPrism LXC. Proceed(y/n)?" yn
|
read -p "Update PhotoPrism LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${PP}
|
echo -e "${PP}
|
||||||
_____ _ _ _____ _
|
_____ _ _ _____ _
|
||||||
| __ \| | | | | __ \ (_)
|
| __ \| | | | | __ \ (_)
|
||||||
| |__) | |__ ___ | |_ ___ | |__) | __ _ ___ _ __ ___
|
| |__) | |__ ___ | |_ ___ | |__) | __ _ ___ _ __ ___
|
||||||
|
@ -34,7 +34,7 @@ ${CL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
header_info
|
header_info
|
||||||
show_menu(){
|
show_menu() {
|
||||||
printf " ${YW} 1)${GN} Release Branch ${CL}\n"
|
printf " ${YW} 1)${GN} Release Branch ${CL}\n"
|
||||||
printf " ${YW} 2)${YW} Develop Branch ${CL}\n"
|
printf " ${YW} 2)${YW} Develop Branch ${CL}\n"
|
||||||
|
|
||||||
|
@ -42,37 +42,41 @@ show_menu(){
|
||||||
read opt
|
read opt
|
||||||
}
|
}
|
||||||
|
|
||||||
option_picked(){
|
option_picked() {
|
||||||
message1=${@:-"${CL}Error: No message passed"}
|
message1=${@:-"${CL}Error: No message passed"}
|
||||||
printf " ${YW}${message1}${CL}\n"
|
printf " ${YW}${message1}${CL}\n"
|
||||||
}
|
}
|
||||||
show_menu
|
show_menu
|
||||||
while [ "$opt" != " " ]
|
while [ "$opt" != " " ]; do
|
||||||
do
|
|
||||||
case $opt in
|
case $opt in
|
||||||
1) clear;
|
1)
|
||||||
header_info;
|
clear
|
||||||
option_picked "Using Release Branch";
|
header_info
|
||||||
|
option_picked "Using Release Branch"
|
||||||
BR="release"
|
BR="release"
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
2) clear;
|
2)
|
||||||
header_info;
|
clear
|
||||||
option_picked "Using Develop Branch";
|
header_info
|
||||||
|
option_picked "Using Develop Branch"
|
||||||
BR="develop"
|
BR="develop"
|
||||||
break;
|
break
|
||||||
;;
|
;;
|
||||||
|
|
||||||
x)exit;
|
x)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
\n)exit;
|
\n)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
*)clear;
|
*)
|
||||||
option_picked "Please choose a Install Branch from the menu";
|
clear
|
||||||
show_menu;
|
option_picked "Please choose a Install Branch from the menu"
|
||||||
|
show_menu
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -en "${GN} Stopping PhotoPrism... "
|
echo -en "${GN} Stopping PhotoPrism... "
|
||||||
sudo systemctl stop photoprism
|
sudo systemctl stop photoprism
|
||||||
|
@ -100,5 +104,3 @@ sudo systemctl start photoprism
|
||||||
echo -e "${CM}${CL} \n"
|
echo -e "${CM}${CL} \n"
|
||||||
|
|
||||||
echo -e "${GN} Finished ${CL} \n "
|
echo -e "${GN} Finished ${CL} \n "
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn
|
read -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -58,7 +58,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -73,13 +73,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.01.24" 13 50 || exit
|
Version: 2022.01.24" 13 50 || exit
|
||||||
info "Plex Media Server Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Plex Media Server Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -89,13 +89,13 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then
|
||||||
fi
|
fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DATA_PATH=/var/lib/plexmediaserver/Library/
|
DATA_PATH=/var/lib/plexmediaserver/Library/
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] ||
|
||||||
die "Plex Media Server directories in '$CTID_FROM' not found."
|
die "Plex Media Server directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${DATA_PATH}" ] ||
|
||||||
die "Plex Media Server directories in '$CTID_TO' not found."
|
die "Plex Media Server directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
#rm -rf ${CTID_TO_PATH}${DATA_PATH}
|
#rm -rf ${CTID_TO_PATH}${DATA_PATH}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn
|
read -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -58,7 +58,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -73,13 +73,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.03.31" 13 50 || exit
|
Version: 2022.03.31" 13 50 || exit
|
||||||
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -90,13 +90,13 @@ fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
DOCKER_PATH=/var/lib/docker/volumes/hass_config/
|
||||||
PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/
|
PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${PODMAN_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${PODMAN_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_FROM' not found."
|
die "Home Assistant directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] ||
|
||||||
die "Home Assistant directories in '$CTID_TO' not found."
|
die "Home Assistant directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
rm -rf ${CTID_TO_PATH}${DOCKER_PATH}
|
rm -rf ${CTID_TO_PATH}${DOCKER_PATH}
|
||||||
|
|
|
@ -4,9 +4,9 @@ echo -e "\e[1;33m This script will install Home Assistant Community Store (HACS)
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Start the HACS Install Script (y/n)?" yn
|
read -p "Start the HACS Install Script (y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash -ex
|
#!/usr/bin/env bash -ex
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
shopt -s inherit_errexit nullglob
|
shopt -s inherit_errexit nullglob
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -17,9 +17,9 @@ echo -e "${BL}This script will Perform Post Install Routines.${CL}"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Start the PBS Post Install Script (y/n)?" yn
|
read -p "Start the PBS Post Install Script (y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ if command -v pveversion >/dev/null 2>&1; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function header_info {
|
function header_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
____ ____ _____ ____ __ ____ __ ____
|
____ ____ _____ ____ __ ____ __ ____
|
||||||
/ __ \/ __ ) ___/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
/ __ \/ __ ) ___/ / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||||
/ /_/ / __ \__ \ / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ `/ / /
|
/ /_/ / __ \__ \ / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ `/ / /
|
||||||
|
@ -52,74 +52,67 @@ function msg_ok() {
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
read -r -p "Disable Enterprise Repository? <y/N> " prompt
|
read -r -p "Disable Enterprise Repository? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Disabling Enterprise Repository"
|
||||||
msg_info "Disabling Enterprise Repository"
|
sleep 2
|
||||||
sleep 2
|
sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pbs-enterprise.list
|
||||||
sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pbs-enterprise.list
|
msg_ok "Disabled Enterprise Repository"
|
||||||
msg_ok "Disabled Enterprise Repository"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Add/Correct PBS Sources (sources.list)? <y/N> " prompt
|
read -r -p "Add/Correct PBS Sources (sources.list)? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Adding or Correcting PBS Sources"
|
||||||
msg_info "Adding or Correcting PBS Sources"
|
cat <<EOF >/etc/apt/sources.list
|
||||||
cat <<EOF > /etc/apt/sources.list
|
|
||||||
deb http://ftp.debian.org/debian bullseye main contrib
|
deb http://ftp.debian.org/debian bullseye main contrib
|
||||||
deb http://ftp.debian.org/debian bullseye-updates main contrib
|
deb http://ftp.debian.org/debian bullseye-updates main contrib
|
||||||
deb http://security.debian.org/debian-security bullseye-security main contrib
|
deb http://security.debian.org/debian-security bullseye-security main contrib
|
||||||
EOF
|
EOF
|
||||||
sleep 2
|
sleep 2
|
||||||
msg_ok "Added or Corrected PBS Sources"
|
msg_ok "Added or Corrected PBS Sources"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Enable No-Subscription Repository? <y/N> " prompt
|
read -r -p "Enable No-Subscription Repository? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Enabling No-Subscription Repository"
|
||||||
msg_info "Enabling No-Subscription Repository"
|
cat <<EOF >>/etc/apt/sources.list
|
||||||
cat <<EOF >> /etc/apt/sources.list
|
|
||||||
deb http://download.proxmox.com/debian/pbs bullseye pbs-no-subscription
|
deb http://download.proxmox.com/debian/pbs bullseye pbs-no-subscription
|
||||||
EOF
|
EOF
|
||||||
sleep 2
|
sleep 2
|
||||||
msg_ok "Enabled No-Subscription Repository"
|
msg_ok "Enabled No-Subscription Repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
|
read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Adding Beta/Test Repository and set disabled"
|
||||||
msg_info "Adding Beta/Test Repository and set disabled"
|
cat <<EOF >>/etc/apt/sources.list
|
||||||
cat <<EOF >> /etc/apt/sources.list
|
|
||||||
# deb http://download.proxmox.com/debian/pbs bullseye pbstest
|
# deb http://download.proxmox.com/debian/pbs bullseye pbstest
|
||||||
EOF
|
EOF
|
||||||
sleep 2
|
sleep 2
|
||||||
msg_ok "Added Beta/Test Repository"
|
msg_ok "Added Beta/Test Repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Disable Subscription Nag? <y/N> " prompt
|
read -r -p "Disable Subscription Nag? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Disabling Subscription Nag"
|
||||||
msg_info "Disabling Subscription Nag"
|
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script
|
||||||
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script
|
apt --reinstall install proxmox-widget-toolkit &>/dev/null
|
||||||
apt --reinstall install proxmox-widget-toolkit &>/dev/null
|
msg_ok "Disabled Subscription Nag"
|
||||||
msg_ok "Disabled Subscription Nag"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Update Proxmox Backup Server now? <y/N> " prompt
|
read -r -p "Update Proxmox Backup Server now? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Updating Proxmox Backup Server (Patience)"
|
||||||
msg_info "Updating Proxmox Backup Server (Patience)"
|
apt-get update &>/dev/null
|
||||||
apt-get update &>/dev/null
|
apt-get -y dist-upgrade &>/dev/null
|
||||||
apt-get -y dist-upgrade &>/dev/null
|
msg_ok "Updated Proxmox Backup Server (⚠ Reboot Recommended)"
|
||||||
msg_ok "Updated Proxmox Backup Server (⚠ Reboot Recommended)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Reboot Proxmox Backup Server now? <y/N> " prompt
|
read -r -p "Reboot Proxmox Backup Server now? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Rebooting Proxmox Backup Server"
|
||||||
msg_info "Rebooting Proxmox Backup Server"
|
sleep 2
|
||||||
sleep 2
|
msg_ok "Completed Post Install Routines"
|
||||||
msg_ok "Completed Post Install Routines"
|
reboot
|
||||||
reboot
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env bash -ex
|
#!/usr/bin/env bash -ex
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
shopt -s inherit_errexit nullglob
|
shopt -s inherit_errexit nullglob
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -17,9 +17,9 @@ echo -e "${BL}This script will Perform Post Install Routines.${CL}"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Start the PVE7 Post Install Script (y/n)?" yn
|
read -p "Start the PVE7 Post Install Script (y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ if ! command -v pveversion >/dev/null 2>&1; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ `pveversion | grep "pve-manager/7" | wc -l` -ne 1 ]; then
|
if [ $(pveversion | grep "pve-manager/7" | wc -l) -ne 1 ]; then
|
||||||
echo -e "\n${RD}⚠ This version of Proxmox Virtual Environment is not supported"
|
echo -e "\n${RD}⚠ This version of Proxmox Virtual Environment is not supported"
|
||||||
echo -e "Requires PVE Version: 7.XX${CL}"
|
echo -e "Requires PVE Version: 7.XX${CL}"
|
||||||
echo -e "\nExiting..."
|
echo -e "\nExiting..."
|
||||||
|
@ -36,7 +36,7 @@ if [ `pveversion | grep "pve-manager/7" | wc -l` -ne 1 ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
____ _ _____________ ____ __ ____ __ ____
|
____ _ _____________ ____ __ ____ __ ____
|
||||||
/ __ \ | / / ____/__ / / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
/ __ \ | / / ____/__ / / __ \____ _____/ /_ / _/___ _____/ /_____ _/ / /
|
||||||
/ /_/ / | / / __/ / / / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ / / /
|
/ /_/ / | / / __/ / / / /_/ / __ \/ ___/ __/ / // __ \/ ___/ __/ __ / / /
|
||||||
|
@ -58,74 +58,67 @@ function msg_ok() {
|
||||||
clear
|
clear
|
||||||
header_info
|
header_info
|
||||||
read -r -p "Disable Enterprise Repository? <y/N> " prompt
|
read -r -p "Disable Enterprise Repository? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Disabling Enterprise Repository"
|
||||||
msg_info "Disabling Enterprise Repository"
|
sleep 2
|
||||||
sleep 2
|
sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pve-enterprise.list
|
||||||
sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pve-enterprise.list
|
msg_ok "Disabled Enterprise Repository"
|
||||||
msg_ok "Disabled Enterprise Repository"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Add/Correct PVE7 Sources (sources.list)? <y/N> " prompt
|
read -r -p "Add/Correct PVE7 Sources (sources.list)? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Adding or Correcting PVE7 Sources"
|
||||||
msg_info "Adding or Correcting PVE7 Sources"
|
cat <<EOF >/etc/apt/sources.list
|
||||||
cat <<EOF > /etc/apt/sources.list
|
|
||||||
deb http://ftp.debian.org/debian bullseye main contrib
|
deb http://ftp.debian.org/debian bullseye main contrib
|
||||||
deb http://ftp.debian.org/debian bullseye-updates main contrib
|
deb http://ftp.debian.org/debian bullseye-updates main contrib
|
||||||
deb http://security.debian.org/debian-security bullseye-security main contrib
|
deb http://security.debian.org/debian-security bullseye-security main contrib
|
||||||
EOF
|
EOF
|
||||||
sleep 2
|
sleep 2
|
||||||
msg_ok "Added or Corrected PVE7 Sources"
|
msg_ok "Added or Corrected PVE7 Sources"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Enable No-Subscription Repository? <y/N> " prompt
|
read -r -p "Enable No-Subscription Repository? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Enabling No-Subscription Repository"
|
||||||
msg_info "Enabling No-Subscription Repository"
|
cat <<EOF >>/etc/apt/sources.list
|
||||||
cat <<EOF >> /etc/apt/sources.list
|
|
||||||
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
|
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
|
||||||
EOF
|
EOF
|
||||||
sleep 2
|
sleep 2
|
||||||
msg_ok "Enabled No-Subscription Repository"
|
msg_ok "Enabled No-Subscription Repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
|
read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Adding Beta/Test Repository and set disabled"
|
||||||
msg_info "Adding Beta/Test Repository and set disabled"
|
cat <<EOF >>/etc/apt/sources.list
|
||||||
cat <<EOF >> /etc/apt/sources.list
|
|
||||||
# deb http://download.proxmox.com/debian/pve bullseye pvetest
|
# deb http://download.proxmox.com/debian/pve bullseye pvetest
|
||||||
EOF
|
EOF
|
||||||
sleep 2
|
sleep 2
|
||||||
msg_ok "Added Beta/Test Repository"
|
msg_ok "Added Beta/Test Repository"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Disable Subscription Nag? <y/N> " prompt
|
read -r -p "Disable Subscription Nag? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Disabling Subscription Nag"
|
||||||
msg_info "Disabling Subscription Nag"
|
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script
|
||||||
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script
|
apt --reinstall install proxmox-widget-toolkit &>/dev/null
|
||||||
apt --reinstall install proxmox-widget-toolkit &>/dev/null
|
msg_ok "Disabled Subscription Nag (Delete browser cache)"
|
||||||
msg_ok "Disabled Subscription Nag (Delete browser cache)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Update Proxmox VE 7 now? <y/N> " prompt
|
read -r -p "Update Proxmox VE 7 now? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Updating Proxmox VE 7 (Patience)"
|
||||||
msg_info "Updating Proxmox VE 7 (Patience)"
|
apt-get update &>/dev/null
|
||||||
apt-get update &>/dev/null
|
apt-get -y dist-upgrade &>/dev/null
|
||||||
apt-get -y dist-upgrade &>/dev/null
|
msg_ok "Updated Proxmox VE 7 (⚠ Reboot Recommended)"
|
||||||
msg_ok "Updated Proxmox VE 7 (⚠ Reboot Recommended)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -r -p "Reboot Proxmox VE 7 now? <y/N> " prompt
|
read -r -p "Reboot Proxmox VE 7 now? <y/N> " prompt
|
||||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
|
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||||
then
|
msg_info "Rebooting Proxmox VE 7"
|
||||||
msg_info "Rebooting Proxmox VE 7"
|
sleep 2
|
||||||
sleep 2
|
msg_ok "Completed Post Install Routines"
|
||||||
msg_ok "Completed Post Install Routines"
|
reboot
|
||||||
reboot
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -4,14 +4,14 @@ set -e
|
||||||
while true; do
|
while true; do
|
||||||
read -p "View CPU Scaling Governors. Proceed(y/n)?" yn
|
read -p "View CPU Scaling Governors. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "
|
echo -e "
|
||||||
_____ _____ _ _
|
_____ _____ _ _
|
||||||
/ ____| __ \| | | |
|
/ ____| __ \| | | |
|
||||||
| | | |__) | | | |
|
| | | |__) | | | |
|
||||||
|
@ -21,16 +21,16 @@ echo -e "
|
||||||
Scaling Governors
|
Scaling Governors
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
show_menu(){
|
show_menu() {
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
GN=`echo "\033[32m"`
|
GN=$(echo "\033[32m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
fgred=`echo "\033[31m"`
|
fgred=$(echo "\033[31m")
|
||||||
header_info
|
header_info
|
||||||
CK=$(uname -r)
|
CK=$(uname -r)
|
||||||
IP=$(hostname -I)
|
IP=$(hostname -I)
|
||||||
# MAC=$(cat /sys/class/net/eno1/address)
|
# MAC=$(cat /sys/class/net/eno1/address)
|
||||||
ACSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
|
ACSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
|
||||||
CCSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
CCSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||||
echo -e "${YW}Proxmox IP ${BL}${IP}${CL}"
|
echo -e "${YW}Proxmox IP ${BL}${IP}${CL}"
|
||||||
|
@ -57,43 +57,51 @@ header_info
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
while [ $opt != '' ]
|
while [ $opt != '' ]; do
|
||||||
do
|
|
||||||
if [ $opt = '' ]; then
|
if [ $opt = '' ]; then
|
||||||
exit;
|
exit
|
||||||
else
|
else
|
||||||
case $opt in
|
case $opt in
|
||||||
1) echo "conservative" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
1)
|
||||||
|
echo "conservative" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
2) echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
2)
|
||||||
|
echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
3) echo "userspace" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
3)
|
||||||
|
echo "userspace" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
4) echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
4)
|
||||||
|
echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
5) echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
5)
|
||||||
|
echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
6) echo "schedutil" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
6)
|
||||||
|
echo "schedutil" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|
||||||
clear
|
clear
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
x)exit;
|
x)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
\n)exit;
|
\n)
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
*)clear;
|
*)
|
||||||
show_menu;
|
clear
|
||||||
|
show_menu
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -7,59 +7,50 @@ dnsUrl="https://download.technitium.com/dns/DnsServerPortable.tar.gz"
|
||||||
|
|
||||||
mkdir -p $dnsDir
|
mkdir -p $dnsDir
|
||||||
installLog="$dnsDir/install.log"
|
installLog="$dnsDir/install.log"
|
||||||
echo "" > $installLog
|
echo "" >$installLog
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "==============================="
|
echo "==============================="
|
||||||
echo "Technitium DNS Server Update"
|
echo "Technitium DNS Server Update"
|
||||||
echo "==============================="
|
echo "==============================="
|
||||||
|
|
||||||
if dotnet --list-runtimes 2> /dev/null | grep -q "Microsoft.NETCore.App 6.0.";
|
if dotnet --list-runtimes 2>/dev/null | grep -q "Microsoft.NETCore.App 6.0."; then
|
||||||
then
|
|
||||||
dotnetFound="yes"
|
dotnetFound="yes"
|
||||||
else
|
else
|
||||||
dotnetFound="no"
|
dotnetFound="no"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $dotnetDir ]
|
if [ -d $dotnetDir ]; then
|
||||||
then
|
|
||||||
dotnetUpdate="yes"
|
dotnetUpdate="yes"
|
||||||
echo "Updating .NET 6 Runtime..."
|
echo "Updating .NET 6 Runtime..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -c 6.0 --runtime dotnet --no-path --install-dir $dotnetDir --verbose >> $installLog 2>&1
|
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -c 6.0 --runtime dotnet --no-path --install-dir $dotnetDir --verbose >>$installLog 2>&1
|
||||||
|
|
||||||
if [ ! -f "/usr/bin/dotnet" ]
|
if [ ! -f "/usr/bin/dotnet" ]; then
|
||||||
then
|
ln -s $dotnetDir/dotnet /usr/bin >>$installLog 2>&1
|
||||||
ln -s $dotnetDir/dotnet /usr/bin >> $installLog 2>&1
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
if dotnet --list-runtimes 2> /dev/null | grep -q "Microsoft.NETCore.App 6.0.";
|
if dotnet --list-runtimes 2>/dev/null | grep -q "Microsoft.NETCore.App 6.0."; then
|
||||||
then
|
if [ "$dotnetUpdate" = "yes" ]; then
|
||||||
if [ "$dotnetUpdate" = "yes" ]
|
|
||||||
then
|
|
||||||
echo ".NET 6 Runtime was updated successfully!"
|
echo ".NET 6 Runtime was updated successfully!"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Failed to update .NET 6 Runtime. Please try again."
|
echo "Failed to update .NET 6 Runtime. Please try again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if curl -o $dnsTar --fail $dnsUrl >> $installLog 2>&1
|
if curl -o $dnsTar --fail $dnsUrl >>$installLog 2>&1; then
|
||||||
then
|
if [ -d $dnsDir ]; then
|
||||||
if [ -d $dnsDir ]
|
|
||||||
then
|
|
||||||
echo "Updating Technitium DNS Server..."
|
echo "Updating Technitium DNS Server..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tar -zxf $dnsTar -C $dnsDir >> $installLog 2>&1
|
tar -zxf $dnsTar -C $dnsDir >>$installLog 2>&1
|
||||||
|
|
||||||
if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ]
|
if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ]; then
|
||||||
then
|
if [ -f "/etc/systemd/system/dns.service" ]; then
|
||||||
if [ -f "/etc/systemd/system/dns.service" ]
|
|
||||||
then
|
|
||||||
echo "Restarting systemd service..."
|
echo "Restarting systemd service..."
|
||||||
systemctl restart dns.service >> $installLog 2>&1
|
systemctl restart dns.service >>$installLog 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest \
|
RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 3, length($2)-4) }')
|
awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
function update_info {
|
function update_info {
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
______ _ ___
|
______ _ ___
|
||||||
/_ __/____(_) (_)_ ______ ___
|
/_ __/____(_) (_)_ ______ ___
|
||||||
/ / / ___/ / / / / / / __ `__ \
|
/ / / ___/ / / / / / / __ `__ \
|
||||||
|
@ -23,9 +23,9 @@ update_info
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Trilium to v$RELEASE. Proceed(y/n)?" yn
|
read -p "This will Update Trilium to v$RELEASE. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
APP="UniFi Update"
|
APP="UniFi Update"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will run ${APP}. Proceed(y/n)?" yn
|
read -p "This will run ${APP}. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${RD}
|
echo -e "${RD}
|
||||||
_ _ _ ______ _
|
_ _ _ ______ _
|
||||||
| | | | (_) ____(_)
|
| | | | (_) ____(_)
|
||||||
| | | |_ __ _| |__ _
|
| | | |_ __ _| |__ _
|
||||||
|
@ -30,4 +30,3 @@ ${CL}"
|
||||||
header_info
|
header_info
|
||||||
sleep 3
|
sleep 3
|
||||||
wget -qL https://get.glennr.nl/unifi/update/unifi-update.sh && bash unifi-update.sh
|
wget -qL https://get.glennr.nl/unifi/update/unifi-update.sh && bash unifi-update.sh
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This Will Update All LXC Containers. Proceed(y/n)?" yn
|
read -p "This Will Update All LXC Containers. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
_ _ _____ _____ _______ ______
|
_ _ _____ _____ _______ ______
|
||||||
| | | | __ \| __ \ /\|__ __| ____|
|
| | | | __ \| __ \ /\|__ __| ____|
|
||||||
| | | | |__) | | | | / \ | | | |__
|
| | | | |__) | | | | / \ | | | |__
|
||||||
|
@ -39,16 +39,14 @@ function update_container() {
|
||||||
}
|
}
|
||||||
read -p "Skip stopped containers? " -n 1 -r
|
read -p "Skip stopped containers? " -n 1 -r
|
||||||
echo
|
echo
|
||||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
then
|
|
||||||
skip=no
|
skip=no
|
||||||
else
|
else
|
||||||
skip=yes
|
skip=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for container in $containers
|
for container in $containers; do
|
||||||
do
|
status=$(pct status $container)
|
||||||
status=`pct status $container`
|
|
||||||
if [ "$skip" == "no" ]; then
|
if [ "$skip" == "no" ]; then
|
||||||
if [ "$status" == "status: stopped" ]; then
|
if [ "$status" == "status: stopped" ]; then
|
||||||
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
|
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
|
||||||
|
@ -67,6 +65,7 @@ do
|
||||||
update_container $container
|
update_container $container
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done; wait
|
done
|
||||||
|
wait
|
||||||
|
|
||||||
echo -e "${GN} Finished, All Containers Updated. ${CL} \n"
|
echo -e "${GN} Finished, All Containers Updated. ${CL} \n"
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env bash -ex
|
#!/usr/bin/env bash -ex
|
||||||
LATEST=$(curl -sL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
LATEST=$(curl -sL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BGN=`echo "\033[4;92m"`
|
BGN=$(echo "\033[4;92m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
DGN=`echo "\033[32m"`
|
DGN=$(echo "\033[32m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
HOLD="-"
|
HOLD="-"
|
||||||
CM="${GN}✓${CL}"
|
CM="${GN}✓${CL}"
|
||||||
|
@ -14,14 +14,14 @@ APP="Uptime Kuma"
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
|
read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
function header_info {
|
function header_info {
|
||||||
echo -e "${DGN}
|
echo -e "${DGN}
|
||||||
_ _ _ _ _ __
|
_ _ _ _ _ __
|
||||||
| | | | | | (_) | |/ /
|
| | | | | | (_) | |/ /
|
||||||
| | | |_v3_ | |_ _ _ __ ___ ___ | ' /_ _ _ __ ___ __ _
|
| | | |_v3_ | |_ _ _ __ ___ ___ | ' /_ _ _ __ ___ __ _
|
||||||
|
@ -45,7 +45,10 @@ function msg_ok() {
|
||||||
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -d "/opt/uptime-kuma" ]; then echo -e "No Uptime Kuma Directory Found."; exit; fi
|
if [ ! -d "/opt/uptime-kuma" ]; then
|
||||||
|
echo -e "No Uptime Kuma Directory Found."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Stopping ${APP}"
|
msg_info "Stopping ${APP}"
|
||||||
sudo systemctl stop uptime-kuma &>/dev/null
|
sudo systemctl stop uptime-kuma &>/dev/null
|
||||||
|
|
|
@ -3,9 +3,9 @@ echo -e "\e[1;33m This script will allow USB passthrough to a PRIVILEGED LXC Con
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
|
read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ for char_dev in ${CHAR_DEVS[@]}; do
|
||||||
CHAR_DEV_STRING+=" -regex \".*/${char_dev}\""
|
CHAR_DEV_STRING+=" -regex \".*/${char_dev}\""
|
||||||
done
|
done
|
||||||
|
|
||||||
read -r -d '' HOOK_SCRIPT <<- EOF || true
|
read -r -d '' HOOK_SCRIPT <<-EOF || true
|
||||||
for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do
|
for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do
|
||||||
dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)";
|
dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)";
|
||||||
mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev});
|
mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev});
|
||||||
|
@ -63,7 +63,7 @@ CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
|
||||||
sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf
|
sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf
|
||||||
cat CTID.conf >$CTID_CONFIG_PATH
|
cat CTID.conf >$CTID_CONFIG_PATH
|
||||||
|
|
||||||
cat <<EOF >> $CTID_CONFIG_PATH
|
cat <<EOF >>$CTID_CONFIG_PATH
|
||||||
lxc.autodev: 1
|
lxc.autodev: 1
|
||||||
lxc.hook.autodev: bash -c '$HOOK_SCRIPT'
|
lxc.hook.autodev: bash -c '$HOOK_SCRIPT'
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest \
|
VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 2, length($2)-3) }')
|
awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
function update_info {
|
function update_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ __ _ _ _
|
__ __ _ _ _
|
||||||
\ \ / / | | | | |
|
\ \ / / | | | | |
|
||||||
\ \ / /_ _ _ _| | |___ ____ _ _ __ __| | ___ _ __
|
\ \ / /_ _ _ _| | |___ ____ _ _ __ __| | ___ _ __
|
||||||
|
@ -24,9 +24,9 @@ update_info
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Vaultwarden to $VAULT (set 2vCPU 2048MiB RAM Min.). Proceed(y/n)?" yn
|
read -p "This will Update Vaultwarden to $VAULT (set 2vCPU 2048MiB RAM Min.). Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VWRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest \
|
VWRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest |
|
||||||
| grep "tag_name" \
|
grep "tag_name" |
|
||||||
| awk '{print substr($2, 2, length($2)-3) }')
|
awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
function update_info {
|
function update_info {
|
||||||
echo -e "${BL}
|
echo -e "${BL}
|
||||||
__ __ _ _ _
|
__ __ _ _ _
|
||||||
\ \ / / | | | | |
|
\ \ / / | | | | |
|
||||||
\ \ /\ / /__| |__ ________ ____ _ _ _| | |_
|
\ \ /\ / /__| |__ ________ ____ _ _ _| | |_
|
||||||
|
@ -23,9 +23,9 @@ update_info
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Update Web-Vault to $VWRELEASE. Proceed(y/n)?" yn
|
read -p "This will Update Web-Vault to $VWRELEASE. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
sleep 2
|
sleep 2
|
||||||
|
@ -36,9 +36,9 @@ sleep 1
|
||||||
echo -e "${GN} Updating to ${VWRELEASE}... ${CL}"
|
echo -e "${GN} Updating to ${VWRELEASE}... ${CL}"
|
||||||
curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$VWRELEASE/bw_web_$VWRELEASE.tar.gz &>/dev/null
|
curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$VWRELEASE/bw_web_$VWRELEASE.tar.gz &>/dev/null
|
||||||
if [ -d "/var/lib/vaultwarden" ]; then
|
if [ -d "/var/lib/vaultwarden" ]; then
|
||||||
tar -xzf bw_web_$VWRELEASE.tar.gz -C /var/lib/vaultwarden/ &>/dev/null
|
tar -xzf bw_web_$VWRELEASE.tar.gz -C /var/lib/vaultwarden/ &>/dev/null
|
||||||
else
|
else
|
||||||
tar -zxf bw_web_$VWRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null
|
tar -zxf bw_web_$VWRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${GN} Cleaning up... ${CL}"
|
echo -e "${GN} Cleaning up... ${CL}"
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
CM='\xE2\x9C\x94\033'
|
CM='\xE2\x9C\x94\033'
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will Install Webmin, Proceed(y/n)?" yn
|
read -p "This will Install Webmin, Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
|
@ -36,5 +36,4 @@ echo -e "${CM}${CL} \r"
|
||||||
IP=$(hostname -I | cut -f1 -d ' ')
|
IP=$(hostname -I | cut -f1 -d ' ')
|
||||||
echo -e "Successfully Installed!! Webmin should be reachable by going to https://${IP}:10000"
|
echo -e "Successfully Installed!! Webmin should be reachable by going to https://${IP}:10000"
|
||||||
|
|
||||||
|
|
||||||
# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/webmin.sh)"
|
# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/webmin.sh)"
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn
|
read -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
@ -58,7 +58,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -73,13 +73,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.01.23" 13 50 || exit
|
Version: 2022.01.23" 13 50 || exit
|
||||||
info "Zigbee2MQTT Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Zigbee2MQTT Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -89,13 +89,13 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then
|
||||||
fi
|
fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DATA_PATH=/opt/zigbee2mqtt/data/
|
DATA_PATH=/opt/zigbee2mqtt/data/
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] ||
|
||||||
die "Zigbee2igbee2MQTT directories in '$CTID_FROM' not found."
|
die "Zigbee2igbee2MQTT directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || \
|
[ -d "${CTID_TO_PATH}${DATA_PATH}" ] ||
|
||||||
die "Zigbee2MQTT directories in '$CTID_TO' not found."
|
die "Zigbee2MQTT directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
#rm -rf ${CTID_TO_PATH}${DATA_PATH}
|
#rm -rf ${CTID_TO_PATH}${DATA_PATH}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn
|
read -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
clear
|
clear
|
||||||
|
@ -59,7 +59,7 @@ while read -r line; do
|
||||||
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
|
||||||
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
|
||||||
fi
|
fi
|
||||||
CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
|
CTID_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
done < <(pct list | awk 'NR>1')
|
done < <(pct list | awk 'NR>1')
|
||||||
while [ -z "${CTID_FROM:+x}" ]; do
|
while [ -z "${CTID_FROM:+x}" ]; do
|
||||||
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
|
||||||
|
@ -74,13 +74,13 @@ while [ -z "${CTID_TO:+x}" ]; do
|
||||||
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
"${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
|
||||||
done
|
done
|
||||||
for i in ${!CTID_MENU[@]}; do
|
for i in ${!CTID_MENU[@]}; do
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
|
||||||
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
|
[ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
|
||||||
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
|
CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
|
||||||
done
|
done
|
||||||
whiptail --defaultno --title "$TITLE" --yesno \
|
whiptail --defaultno --title "$TITLE" --yesno \
|
||||||
"Are you sure you want to copy data between the following LXCs?
|
"Are you sure you want to copy data between the following LXCs?
|
||||||
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
$CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
|
||||||
Version: 2022.09.21" 13 50 || exit
|
Version: 2022.09.21" 13 50 || exit
|
||||||
info "Zwavejs2MQTT Data from '$CTID_FROM' to '$CTID_TO'"
|
info "Zwavejs2MQTT Data from '$CTID_FROM' to '$CTID_TO'"
|
||||||
|
@ -91,13 +91,13 @@ fi
|
||||||
msg "Mounting Container Disks..."
|
msg "Mounting Container Disks..."
|
||||||
DATA_PATH=/opt/zwavejs2mqtt/store/
|
DATA_PATH=/opt/zwavejs2mqtt/store/
|
||||||
DATA_PATH_NEW=/opt/zwave-js-ui/store/
|
DATA_PATH_NEW=/opt/zwave-js-ui/store/
|
||||||
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
|
||||||
[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || \
|
[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] ||
|
||||||
die "Zwavejs2MQTT directories in '$CTID_FROM' not found."
|
die "Zwavejs2MQTT directories in '$CTID_FROM' not found."
|
||||||
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
|
CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
|
||||||
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
|
||||||
[ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] || \
|
[ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] ||
|
||||||
die "Zwavejs2MQTT directories in '$CTID_TO' not found."
|
die "Zwavejs2MQTT directories in '$CTID_TO' not found."
|
||||||
|
|
||||||
#rm -rf ${CTID_TO_PATH}${DATA_PATH}
|
#rm -rf ${CTID_TO_PATH}${DATA_PATH}
|
||||||
|
@ -117,4 +117,3 @@ rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PA
|
||||||
echo -en "\e[1A\e[0K\e[1A\e[0K"
|
echo -en "\e[1A\e[0K\e[1A\e[0K"
|
||||||
|
|
||||||
info "Successfully Transferred Data."
|
info "Successfully Transferred Data."
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
set -e
|
set -e
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
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}"
|
CROSS="${RD}✗${CL}"
|
||||||
BFR="\\r\\033[K"
|
BFR="\\r\\033[K"
|
||||||
|
@ -25,7 +25,7 @@ function msg_error() {
|
||||||
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
|
||||||
}
|
}
|
||||||
clear
|
clear
|
||||||
cat << "EOF"
|
cat <<"EOF"
|
||||||
_____ _______ __ ______
|
_____ _______ __ ______
|
||||||
/__ /_ ______ __ _____ / / ___/ / / / / _/
|
/__ /_ ______ __ _____ / / ___/ / / / / _/
|
||||||
/ /| | /| / / __ `/ | / / _ \ __ / /\__ \ / / / // /
|
/ /| | /| / / __ `/ | / / _ \ __ / /\__ \ / / / // /
|
||||||
|
@ -38,12 +38,15 @@ EOF
|
||||||
while true; do
|
while true; do
|
||||||
read -p "This will update ZWave JS UI to $RELEASE. Proceed(y/n)?" yn
|
read -p "This will update ZWave JS UI to $RELEASE. Proceed(y/n)?" yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) break;;
|
[Yy]*) break ;;
|
||||||
[Nn]* ) exit;;
|
[Nn]*) exit ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
*) echo "Please answer yes or no." ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
if [ ! -d /opt/zwave-js-ui ]; then msg_error "No Zwave JS UI Install Detected!"; exit; fi
|
if [ ! -d /opt/zwave-js-ui ]; then
|
||||||
|
msg_error "No Zwave JS UI Install Detected!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Stopping Z-wave JS UI"
|
msg_info "Stopping Z-wave JS UI"
|
||||||
systemctl stop zwave-js-ui.service
|
systemctl stop zwave-js-ui.service
|
||||||
|
@ -56,7 +59,7 @@ unzip zwave-js-ui-${RELEASE}-linux.zip &>/dev/null
|
||||||
msg_ok "Updated Z-wave JS UI"
|
msg_ok "Updated Z-wave JS UI"
|
||||||
|
|
||||||
msg_info "Updating Z-wave JS UI service file"
|
msg_info "Updating Z-wave JS UI service file"
|
||||||
cat << EOF > /etc/systemd/system/zwave-js-ui.service
|
cat <<EOF >/etc/systemd/system/zwave-js-ui.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=zwave-js-ui
|
Description=zwave-js-ui
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
YW=`echo "\033[33m"`
|
YW=$(echo "\033[33m")
|
||||||
RD=`echo "\033[01;31m"`
|
RD=$(echo "\033[01;31m")
|
||||||
BL=`echo "\033[36m"`
|
BL=$(echo "\033[36m")
|
||||||
GN=`echo "\033[1;92m"`
|
GN=$(echo "\033[1;92m")
|
||||||
CL=`echo "\033[m"`
|
CL=$(echo "\033[m")
|
||||||
RETRY_NUM=10
|
RETRY_NUM=10
|
||||||
RETRY_EVERY=3
|
RETRY_EVERY=3
|
||||||
NUM=$RETRY_NUM
|
NUM=$RETRY_NUM
|
||||||
|
@ -47,12 +47,11 @@ msg_info "Setting up Container OS "
|
||||||
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
|
sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
|
||||||
locale-gen >/dev/null
|
locale-gen >/dev/null
|
||||||
while [ "$(hostname -I)" = "" ]; do
|
while [ "$(hostname -I)" = "" ]; do
|
||||||
1>&2 echo -en "${CROSS}${RD} No Network! "
|
echo 1>&2 -en "${CROSS}${RD} No Network! "
|
||||||
sleep $RETRY_EVERY
|
sleep $RETRY_EVERY
|
||||||
((NUM--))
|
((NUM--))
|
||||||
if [ $NUM -eq 0 ]
|
if [ $NUM -eq 0 ]; then
|
||||||
then
|
echo 1>&2 -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
|
||||||
1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -61,9 +60,12 @@ msg_ok "Network Connected: ${BL}$(hostname -I)"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
alias die=''
|
alias die=''
|
||||||
if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else msg_error "Internet NOT Connected"; exit 1; fi;
|
if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else
|
||||||
|
msg_error "Internet NOT Connected"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
|
RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
|
||||||
if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi;
|
if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi
|
||||||
alias die='EXIT=$? LINE=$LINENO error_exit'
|
alias die='EXIT=$? LINE=$LINENO error_exit'
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -81,23 +83,23 @@ msg_info "Installing AdGuard Home"
|
||||||
curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh &>/dev/null
|
curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh &>/dev/null
|
||||||
msg_ok "Installed AdGuard Home"
|
msg_ok "Installed AdGuard Home"
|
||||||
|
|
||||||
PASS=$(grep -w "root" /etc/shadow | cut -b6);
|
PASS=$(grep -w "root" /etc/shadow | cut -b6)
|
||||||
if [[ $PASS != $ ]]; then
|
if [[ $PASS != $ ]]; then
|
||||||
msg_info "Customizing Container"
|
msg_info "Customizing Container"
|
||||||
rm /etc/motd
|
rm /etc/motd
|
||||||
rm /etc/update-motd.d/10-uname
|
rm /etc/update-motd.d/10-uname
|
||||||
touch ~/.hushlogin
|
touch ~/.hushlogin
|
||||||
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
|
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
|
||||||
mkdir -p $(dirname $GETTY_OVERRIDE)
|
mkdir -p $(dirname $GETTY_OVERRIDE)
|
||||||
cat << EOF > $GETTY_OVERRIDE
|
cat <<EOF >$GETTY_OVERRIDE
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=
|
ExecStart=
|
||||||
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM
|
ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM
|
||||||
EOF
|
EOF
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
||||||
msg_ok "Customized Container"
|
msg_ok "Customized Container"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
apt-get autoremove >/dev/null
|
apt-get autoremove >/dev/null
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue