From 1e8ac7e63e4eed34fe7faefd6f10ae73ede9e3a1 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 28 Sep 2022 08:16:38 -0400 Subject: [PATCH] maintenance (#569) update whiptail menu --- ct/adguard-v4.sh | 68 ++++++++++++---------------- ct/casaos-v4.sh | 68 ++++++++++++---------------- ct/daemonsync-v4.sh | 68 ++++++++++++---------------- ct/dashy-v4.sh | 68 ++++++++++++---------------- ct/debian-v4.sh | 68 ++++++++++++---------------- ct/deconz-v4.sh | 84 +++++++++++++---------------------- ct/docker-v4.sh | 68 ++++++++++++---------------- ct/emby-v4.sh | 74 +++++++++++++----------------- ct/emqx-v4.sh | 68 ++++++++++++---------------- ct/esphome-v4.sh | 68 ++++++++++++---------------- ct/grafana-v4.sh | 68 ++++++++++++---------------- ct/grocy-v4.sh | 68 ++++++++++++---------------- ct/heimdalldashboard-v4.sh | 68 ++++++++++++---------------- ct/homeassistant-v4.sh | 68 ++++++++++++---------------- ct/homebridge-v4.sh | 68 ++++++++++++---------------- ct/homepage-v4.sh | 68 ++++++++++++---------------- ct/influxdb-v4.sh | 68 ++++++++++++---------------- ct/iobroker-v4.sh | 68 ++++++++++++---------------- ct/jellyfin-v4.sh | 74 +++++++++++++----------------- ct/keycloak-v4.sh | 68 ++++++++++++---------------- ct/magicmirror-v4.sh | 68 ++++++++++++---------------- ct/mariadb-v4.sh | 68 ++++++++++++---------------- ct/meshcentral-v4.sh | 68 ++++++++++++---------------- ct/motioneye-v4.sh | 68 ++++++++++++---------------- ct/mqtt-v4.sh | 68 ++++++++++++---------------- ct/n8n-v4.sh | 68 ++++++++++++---------------- ct/navidrome-v4.sh | 68 ++++++++++++---------------- ct/nextcloudpi-v4.sh | 72 +++++++++++++----------------- ct/nginx-proxy-manager-v4.sh | 68 ++++++++++++---------------- ct/nocodb-v4.sh | 68 ++++++++++++---------------- ct/node-red-v4.sh | 68 ++++++++++++---------------- ct/omada-v4.sh | 74 +++++++++++++----------------- ct/omv-v4.sh | 72 +++++++++++++----------------- ct/openhab-v4.sh | 68 ++++++++++++---------------- ct/paperless-ngx-v4.sh | 68 ++++++++++++---------------- ct/photoprism-v4.sh | 68 ++++++++++++---------------- ct/pihole-v4.sh | 72 +++++++++++++----------------- ct/plex-v4.sh | 74 +++++++++++++----------------- ct/podman-homeassistant-v4.sh | 72 +++++++++++++----------------- ct/postgresql-v4.sh | 68 ++++++++++++---------------- ct/prometheus-v4.sh | 68 ++++++++++++---------------- ct/syncthing-v4.sh | 68 ++++++++++++---------------- ct/technitiumdns-v4.sh | 68 ++++++++++++---------------- ct/trilium-v4.sh | 68 ++++++++++++---------------- ct/ubuntu-v4.sh | 74 +++++++++++++----------------- ct/unifi-v4.sh | 68 ++++++++++++---------------- ct/uptimekuma-v4.sh | 68 ++++++++++++---------------- ct/vaultwarden-v4.sh | 68 ++++++++++++---------------- ct/whoogle-v4.sh | 68 ++++++++++++---------------- ct/wikijs-v4.sh | 68 ++++++++++++---------------- ct/wireguard-v4.sh | 68 ++++++++++++---------------- ct/zigbee2mqtt-v4.sh | 68 ++++++++++++---------------- ct/zwave-js-ui-v4.sh | 68 ++++++++++++---------------- 53 files changed, 1552 insertions(+), 2114 deletions(-) diff --git a/ct/adguard-v4.sh b/ct/adguard-v4.sh index e54d84aa..d0f3d6a9 100644 --- a/ct/adguard-v4.sh +++ b/ct/adguard-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/casaos-v4.sh b/ct/casaos-v4.sh index 344b3534..4458f5c5 100644 --- a/ct/casaos-v4.sh +++ b/ct/casaos-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/daemonsync-v4.sh b/ct/daemonsync-v4.sh index 07334f6a..a22b3961 100644 --- a/ct/daemonsync-v4.sh +++ b/ct/daemonsync-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/dashy-v4.sh b/ct/dashy-v4.sh index 07232766..4e95a911 100644 --- a/ct/dashy-v4.sh +++ b/ct/dashy-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/debian-v4.sh b/ct/debian-v4.sh index ddc48a91..c440df07 100644 --- a/ct/debian-v4.sh +++ b/ct/debian-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/deconz-v4.sh b/ct/deconz-v4.sh index c7a671bf..06cc25ad 100644 --- a/ct/deconz-v4.sh +++ b/ct/deconz-v4.sh @@ -97,29 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \ -"18.04" "Bionic" OFF \ -"20.04" "Focal" ON \ -"21.10" "Impish" OFF \ -"22.04" "Jammy" OFF \ -3>&1 1>&2 2>&3) -exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" -else - exit -fi -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ -"1" "Unprivileged" OFF \ -"0" "Privileged" ON \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -129,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -190,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -200,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -210,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -220,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/docker-v4.sh b/ct/docker-v4.sh index 5534f38a..a7357282 100644 --- a/ct/docker-v4.sh +++ b/ct/docker-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/emby-v4.sh b/ct/emby-v4.sh index db03bdfa..e90725f1 100644 --- a/ct/emby-v4.sh +++ b/ct/emby-v4.sh @@ -104,22 +104,16 @@ var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 "21.10" "Impish" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" -else - exit -fi -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +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 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -129,58 +123,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -190,7 +176,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -200,7 +186,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -210,7 +196,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -220,7 +206,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/emqx-v4.sh b/ct/emqx-v4.sh index 4cf17014..5e7f2885 100644 --- a/ct/emqx-v4.sh +++ b/ct/emqx-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/esphome-v4.sh b/ct/esphome-v4.sh index 9172c085..e3174370 100644 --- a/ct/esphome-v4.sh +++ b/ct/esphome-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/grafana-v4.sh b/ct/grafana-v4.sh index d2622f59..58ce46cf 100644 --- a/ct/grafana-v4.sh +++ b/ct/grafana-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/grocy-v4.sh b/ct/grocy-v4.sh index 54755899..09972d1a 100644 --- a/ct/grocy-v4.sh +++ b/ct/grocy-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/heimdalldashboard-v4.sh b/ct/heimdalldashboard-v4.sh index 4c534619..4a3ce6e5 100644 --- a/ct/heimdalldashboard-v4.sh +++ b/ct/heimdalldashboard-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/homeassistant-v4.sh b/ct/homeassistant-v4.sh index 3b2083ad..2a521357 100644 --- a/ct/homeassistant-v4.sh +++ b/ct/homeassistant-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/homebridge-v4.sh b/ct/homebridge-v4.sh index abbee6a9..7b3e7ddf 100644 --- a/ct/homebridge-v4.sh +++ b/ct/homebridge-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/homepage-v4.sh b/ct/homepage-v4.sh index 97df3d81..3b2d63de 100644 --- a/ct/homepage-v4.sh +++ b/ct/homepage-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/influxdb-v4.sh b/ct/influxdb-v4.sh index 7f9f991e..3ab809b5 100644 --- a/ct/influxdb-v4.sh +++ b/ct/influxdb-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/iobroker-v4.sh b/ct/iobroker-v4.sh index 364cf6e1..71bfa4ae 100644 --- a/ct/iobroker-v4.sh +++ b/ct/iobroker-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/jellyfin-v4.sh b/ct/jellyfin-v4.sh index 88334668..76421a3c 100644 --- a/ct/jellyfin-v4.sh +++ b/ct/jellyfin-v4.sh @@ -104,22 +104,16 @@ var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 "21.10" "Impish" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" -else - exit -fi -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +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 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -129,58 +123,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -190,7 +176,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -200,7 +186,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -210,7 +196,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -220,7 +206,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/keycloak-v4.sh b/ct/keycloak-v4.sh index 2c5db5a9..966edbe8 100644 --- a/ct/keycloak-v4.sh +++ b/ct/keycloak-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/magicmirror-v4.sh b/ct/magicmirror-v4.sh index 06aee016..cfc67cfc 100644 --- a/ct/magicmirror-v4.sh +++ b/ct/magicmirror-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/mariadb-v4.sh b/ct/mariadb-v4.sh index 3187a6d1..2b4820ae 100644 --- a/ct/mariadb-v4.sh +++ b/ct/mariadb-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/meshcentral-v4.sh b/ct/meshcentral-v4.sh index 602a6db5..325b2b68 100644 --- a/ct/meshcentral-v4.sh +++ b/ct/meshcentral-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/motioneye-v4.sh b/ct/motioneye-v4.sh index 7a53e637..8069c1b0 100644 --- a/ct/motioneye-v4.sh +++ b/ct/motioneye-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/mqtt-v4.sh b/ct/mqtt-v4.sh index 899552a9..7210af65 100644 --- a/ct/mqtt-v4.sh +++ b/ct/mqtt-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/n8n-v4.sh b/ct/n8n-v4.sh index d683c6fd..496e626d 100644 --- a/ct/n8n-v4.sh +++ b/ct/n8n-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/navidrome-v4.sh b/ct/navidrome-v4.sh index 4cb19868..446f1b22 100644 --- a/ct/navidrome-v4.sh +++ b/ct/navidrome-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/nextcloudpi-v4.sh b/ct/nextcloudpi-v4.sh index 22fed957..f39b2a59 100644 --- a/ct/nextcloudpi-v4.sh +++ b/ct/nextcloudpi-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ -"1" "Unprivileged" OFF \ -"0" "Privileged" ON \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/nginx-proxy-manager-v4.sh b/ct/nginx-proxy-manager-v4.sh index bea15edf..f99bb2e4 100644 --- a/ct/nginx-proxy-manager-v4.sh +++ b/ct/nginx-proxy-manager-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/nocodb-v4.sh b/ct/nocodb-v4.sh index 050e5ff9..4cdfe3f5 100644 --- a/ct/nocodb-v4.sh +++ b/ct/nocodb-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/node-red-v4.sh b/ct/node-red-v4.sh index 9230148b..33400099 100644 --- a/ct/node-red-v4.sh +++ b/ct/node-red-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/omada-v4.sh b/ct/omada-v4.sh index f4f1a9af..3a2c7abc 100644 --- a/ct/omada-v4.sh +++ b/ct/omada-v4.sh @@ -104,22 +104,16 @@ var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 "22.04" "Jammy" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" -else - exit -fi -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +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 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -129,58 +123,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -190,7 +176,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -200,7 +186,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -210,7 +196,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -220,7 +206,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/omv-v4.sh b/ct/omv-v4.sh index bff9e4db..0e84cfb6 100644 --- a/ct/omv-v4.sh +++ b/ct/omv-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ -"1" "Unprivileged" OFF \ -"0" "Privileged" ON \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/openhab-v4.sh b/ct/openhab-v4.sh index e724c8e3..8e16f806 100644 --- a/ct/openhab-v4.sh +++ b/ct/openhab-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/paperless-ngx-v4.sh b/ct/paperless-ngx-v4.sh index 69f151d4..58e2a0b5 100644 --- a/ct/paperless-ngx-v4.sh +++ b/ct/paperless-ngx-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/photoprism-v4.sh b/ct/photoprism-v4.sh index cbfa9b92..0b1825cf 100644 --- a/ct/photoprism-v4.sh +++ b/ct/photoprism-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/pihole-v4.sh b/ct/pihole-v4.sh index d917e1f5..70252cbb 100644 --- a/ct/pihole-v4.sh +++ b/ct/pihole-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ -"1" "Unprivileged" OFF \ -"0" "Privileged" ON \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/plex-v4.sh b/ct/plex-v4.sh index 0cbeeb10..eeed0cca 100644 --- a/ct/plex-v4.sh +++ b/ct/plex-v4.sh @@ -104,22 +104,16 @@ var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 "21.10" "Impish" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" -else - exit -fi -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +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 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -129,58 +123,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -190,7 +176,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -200,7 +186,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -210,7 +196,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -220,7 +206,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/podman-homeassistant-v4.sh b/ct/podman-homeassistant-v4.sh index 55efec47..2557a709 100644 --- a/ct/podman-homeassistant-v4.sh +++ b/ct/podman-homeassistant-v4.sh @@ -100,17 +100,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ -"1" "Unprivileged" OFF \ -"0" "Privileged" ON \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ +"1" "Unprivileged" ON \ +"0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -120,58 +118,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -181,7 +171,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -191,7 +181,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -201,7 +191,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -211,7 +201,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/postgresql-v4.sh b/ct/postgresql-v4.sh index ef9302e0..dd29509b 100644 --- a/ct/postgresql-v4.sh +++ b/ct/postgresql-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/prometheus-v4.sh b/ct/prometheus-v4.sh index 587412e9..e8765aad 100644 --- a/ct/prometheus-v4.sh +++ b/ct/prometheus-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/syncthing-v4.sh b/ct/syncthing-v4.sh index 27d73050..10c55f42 100644 --- a/ct/syncthing-v4.sh +++ b/ct/syncthing-v4.sh @@ -98,17 +98,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -118,58 +116,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -179,7 +169,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -189,7 +179,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -199,7 +189,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -209,7 +199,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/technitiumdns-v4.sh b/ct/technitiumdns-v4.sh index e7f78fd4..d23f72c2 100644 --- a/ct/technitiumdns-v4.sh +++ b/ct/technitiumdns-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/trilium-v4.sh b/ct/trilium-v4.sh index 8dc66c67..c9b9baba 100644 --- a/ct/trilium-v4.sh +++ b/ct/trilium-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/ubuntu-v4.sh b/ct/ubuntu-v4.sh index f485ca4e..fca16b27 100644 --- a/ct/ubuntu-v4.sh +++ b/ct/ubuntu-v4.sh @@ -104,22 +104,16 @@ var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 "22.04" "Jammy" ON \ 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Ubuntu Version: ${BGN}$var_version${CL}" -else - exit -fi -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +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 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -129,58 +123,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -190,7 +176,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -200,7 +186,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -210,7 +196,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -220,7 +206,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/unifi-v4.sh b/ct/unifi-v4.sh index d6f7b954..2f204933 100644 --- a/ct/unifi-v4.sh +++ b/ct/unifi-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/uptimekuma-v4.sh b/ct/uptimekuma-v4.sh index 4f7f4e3b..4c4a2761 100644 --- a/ct/uptimekuma-v4.sh +++ b/ct/uptimekuma-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/vaultwarden-v4.sh b/ct/vaultwarden-v4.sh index 02b0f684..cac70cf7 100644 --- a/ct/vaultwarden-v4.sh +++ b/ct/vaultwarden-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/whoogle-v4.sh b/ct/whoogle-v4.sh index 21a1ecdf..6adc5170 100644 --- a/ct/whoogle-v4.sh +++ b/ct/whoogle-v4.sh @@ -96,17 +96,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -116,58 +114,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -177,7 +167,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -187,7 +177,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -197,7 +187,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -207,7 +197,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/wikijs-v4.sh b/ct/wikijs-v4.sh index b41e5a4a..38c99f5a 100644 --- a/ct/wikijs-v4.sh +++ b/ct/wikijs-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/wireguard-v4.sh b/ct/wireguard-v4.sh index 564dd218..98c074ac 100644 --- a/ct/wireguard-v4.sh +++ b/ct/wireguard-v4.sh @@ -98,17 +98,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" ON \ "0" "Privileged" OFF \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -118,58 +116,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -179,7 +169,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -189,7 +179,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -199,7 +189,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -209,7 +199,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/zigbee2mqtt-v4.sh b/ct/zigbee2mqtt-v4.sh index 48fcc97f..14057e7a 100644 --- a/ct/zigbee2mqtt-v4.sh +++ b/ct/zigbee2mqtt-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID?" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings diff --git a/ct/zwave-js-ui-v4.sh b/ct/zwave-js-ui-v4.sh index ab9fc567..a56a065c 100644 --- a/ct/zwave-js-ui-v4.sh +++ b/ct/zwave-js-ui-v4.sh @@ -97,17 +97,15 @@ function default_settings() { echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" } function advanced_settings() { -CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist "Choose Type" 8 58 2 \ +CT_TYPE=$(whiptail --title "CONTAINER TYPE" --radiolist --cancel-button Exit-Script "Choose Type" 8 58 2 \ "1" "Unprivileged" OFF \ "0" "Privileged" ON \ 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container Type: ${BGN}$CT_TYPE${CL}" -else - exit fi -PW1=$(whiptail --inputbox "Set Root Password" 8 58 --title "PASSWORD(leave blank for automatic login)" 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=$? if [ $exitstatus = 0 ]; then if [ -z $PW1 ]; then PW1="Automatic Login" PW=" "; @@ -117,58 +115,50 @@ else echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}" fi fi -CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}" +if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi; fi -CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" 3>&1 1>&2 2>&3) +CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - HN=$(echo ${CT_NAME,,} | tr -d ' ') - echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}" +if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; else - exit + if [ $exitstatus = 0 ]; then HN=$(echo ${CT_NAME,,} | tr -d ' '); echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"; fi; fi -DISK_SIZE=$(whiptail --inputbox "Set Disk Size in GB" 8 58 $var_disk --title "DISK SIZE" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}" +if [ -z $DISK_SIZE ]; then DISK_SIZE="$var_disk"; echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; +else + if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Disk Size: ${BGN}$DISK_SIZE${CL}"; fi; if ! [[ $DISK_SIZE =~ $INTEGER ]] ; then echo -e "${RD}⚠ DISK SIZE MUST BE A INTEGER NUMBER!${CL}"; advanced_settings; fi; -else - exit fi -CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" 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=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}" +if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"; fi; fi -RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" 3>&1 1>&2 2>&3) +RAM_SIZE=$(whiptail --inputbox "Allocate RAM in MiB" 8 58 $var_ram --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}" +if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; else - exit + if [ $exitstatus = 0 ]; then echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"; fi; fi -BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" 3>&1 1>&2 2>&3) +BRG=$(whiptail --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE"--cancel-button Exit-Script 3>&1 1>&2 2>&3) exitstatus=$? -if [ $exitstatus = 0 ]; then - echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}" +if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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 [ $exitstatus = 0 ]; then - echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}" +if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; else - exit + 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" 3>&1 1>&2 2>&3) +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=""; @@ -178,7 +168,7 @@ else echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}" fi fi -MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58 --title "MAC ADDRESS" 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=$? if [ $exitstatus = 0 ]; then if [ -z $MAC1 ]; then MAC1="Default" MAC=""; @@ -188,7 +178,7 @@ else echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}" fi fi -VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58 --title "VLAN" 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=$? if [ $exitstatus = 0 ]; then if [ -z $VLAN1 ]; then VLAN1="Default" VLAN=""; @@ -198,7 +188,7 @@ else echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}" fi fi -if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" 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}" else clear @@ -208,7 +198,7 @@ else fi } function start_script() { -if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" 10 58); then +if (whiptail --title "SETTINGS" --yesno "Use Default Settings?" --no-button Advanced 10 58); then header_info echo -e "${BL}Using Default Settings${CL}" default_settings