Browse Source

Maintenance (#681)

* Maintenance
tteckster 2 years ago
parent
commit
8e331fcbff
100 changed files with 10859 additions and 9549 deletions
  1. 180 156
      ct/adguard-v4.sh
  2. 180 156
      ct/blocky-v4.sh
  3. 181 157
      ct/casaos-v4.sh
  4. 180 156
      ct/daemonsync-v4.sh
  5. 180 156
      ct/dashy-v4.sh
  6. 182 158
      ct/deconz-v4.sh
  7. 181 157
      ct/docker-v4.sh
  8. 189 165
      ct/emby-v4.sh
  9. 180 156
      ct/emqx-v4.sh
  10. 180 156
      ct/esphome-v4.sh
  11. 180 156
      ct/grafana-v4.sh
  12. 180 156
      ct/grocy-v4.sh
  13. 180 156
      ct/heimdalldashboard-v4.sh
  14. 182 158
      ct/homeassistant-core-v4.sh
  15. 182 158
      ct/homeassistant-v4.sh
  16. 180 156
      ct/homebridge-v4.sh
  17. 180 156
      ct/homepage-v4.sh
  18. 180 156
      ct/influxdb-v4.sh
  19. 180 156
      ct/iobroker-v4.sh
  20. 190 166
      ct/jellyfin-v4.sh
  21. 180 156
      ct/keycloak-v4.sh
  22. 180 156
      ct/magicmirror-v4.sh
  23. 180 156
      ct/mariadb-v4.sh
  24. 180 156
      ct/meshcentral-v4.sh
  25. 180 156
      ct/motioneye-v4.sh
  26. 180 156
      ct/n8n-v4.sh
  27. 180 156
      ct/navidrome-v4.sh
  28. 180 156
      ct/nextcloudpi-v4.sh
  29. 180 156
      ct/nginx-proxy-manager-v4.sh
  30. 180 156
      ct/nocodb-v4.sh
  31. 180 156
      ct/node-red-v4.sh
  32. 189 165
      ct/omada-v4.sh
  33. 181 157
      ct/omv-v4.sh
  34. 180 156
      ct/openhab-v4.sh
  35. 180 156
      ct/paperless-ngx-v4.sh
  36. 180 156
      ct/photoprism-v4.sh
  37. 180 156
      ct/pihole-v4.sh
  38. 190 166
      ct/plex-v4.sh
  39. 181 157
      ct/podman-homeassistant-v4.sh
  40. 180 156
      ct/postgresql-v4.sh
  41. 180 156
      ct/prometheus-v4.sh
  42. 180 156
      ct/syncthing-v4.sh
  43. 180 156
      ct/technitiumdns-v4.sh
  44. 180 156
      ct/trilium-v4.sh
  45. 189 165
      ct/ubuntu-v4.sh
  46. 181 157
      ct/umbrel-v4.sh
  47. 180 156
      ct/unifi-v4.sh
  48. 180 156
      ct/uptimekuma-v4.sh
  49. 180 156
      ct/vaultwarden-v4.sh
  50. 180 156
      ct/whoogle-v4.sh
  51. 180 156
      ct/wikijs-v4.sh
  52. 180 156
      ct/wireguard-v4.sh
  53. 181 157
      ct/zigbee2mqtt-v4.sh
  54. 181 157
      ct/zwave-js-ui-v4.sh
  55. 7 7
      misc/add-tailscale-lxc.sh
  56. 21 21
      misc/code-server.sh
  57. 20 15
      misc/container-restore-from-backup.sh
  58. 20 15
      misc/core-restore-from-backup.sh
  59. 17 17
      misc/crowdsec.sh
  60. 9 9
      misc/dashy-update.sh
  61. 98 91
      misc/edge-kernel.sh
  62. 11 11
      misc/emby-update.sh
  63. 18 18
      misc/filebrowser.sh
  64. 8 8
      misc/frigate-support.sh
  65. 22 22
      misc/ha-copy-data-podman.sh
  66. 22 22
      misc/ha-copy-data.sh
  67. 22 22
      misc/hacontainer2hacore-data.sh
  68. 22 22
      misc/hacore2hacontainer-data.sh
  69. 22 22
      misc/hacore2hacore-data.sh
  70. 3 3
      misc/hacs-core.sh
  71. 3 3
      misc/hacs.sh
  72. 23 24
      misc/heimdalldashboard-all-update.sh
  73. 20 20
      misc/homepage-update.sh
  74. 51 52
      misc/kernel-clean.sh
  75. 11 11
      misc/latest-update-menu.sh
  76. 11 11
      misc/navidrome-update.sh
  77. 23 24
      misc/nocodb-update.sh
  78. 73 64
      misc/node-red-themes.sh
  79. 49 49
      misc/npm_update.sh
  80. 9 9
      misc/paperless-ngx-update.sh
  81. 39 37
      misc/photoprism-update.sh
  82. 22 22
      misc/pms-copy-data.sh
  83. 22 22
      misc/podman-copy-data-docker.sh
  84. 3 3
      misc/podman_hacs.sh
  85. 48 55
      misc/post-pbs-install.sh
  86. 54 61
      misc/post-pve-install.sh
  87. 46 38
      misc/scaling-governor.sh
  88. 26 35
      misc/technitiumdns-update.sh
  89. 11 11
      misc/trilium-update.sh
  90. 9 10
      misc/unifi-update.sh
  91. 35 36
      misc/update-lxcs.sh
  92. 15 12
      misc/uptimekuma-update.sh
  93. 8 8
      misc/usb-passthrough.sh
  94. 11 11
      misc/vaultwarden-update.sh
  95. 14 14
      misc/web-vault-update.sh
  96. 9 10
      misc/webmin.sh
  97. 22 22
      misc/z2m-copy-data.sh
  98. 22 23
      misc/zwave-copy-data.sh
  99. 15 12
      misc/zwave-js-ui-update.sh
  100. 33 31
      setup/adguard-install.sh

+ 180 - 156
ct/adguard-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${GN}
+  echo -e "${GN}
     ___       __                           __
    /   | ____/ /___ ___  ______ __________/ /
   / /| |/ __  / __  / / / / __  / ___/ __  / 
@@ -53,168 +53,192 @@ echo -e "${GN}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/blocky-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     ____  __           __        
    / __ )/ /___v4_____/ /____  __
   / __  / / __ \/ ___/ //_/ / / /
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 181 - 157
ct/casaos-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
    ______                 ____  _____
   / ____/___ __v4______ _/ __ \/ ___/
  / /   / __ `/ ___/ __ `/ / / /\__ \ 
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	    echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-	    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-                echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-                VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 EOF

+ 180 - 156
ct/daemonsync-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     ____                                      _____                 
    / __ \____ ____  ____ ___  ____  ____     / ___/__  ______  _____
   / / / / __  / _ \/ __  __ \/ __ \/ __ \    \__ \/ / / / __ \/ ___/
@@ -53,168 +53,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/dashy-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     ____             __         
    / __ \____ ______/ /_  __  __
   / / / / __  / ___/ __ \/ / / /
@@ -53,168 +53,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 182 - 158
ct/deconz-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
        __     __________  _   _______
   ____/ /v4  / ____/ __ \/ | / /__  /
  / __  / _ \/ /   / / / /  |/ /  / / 
@@ -52,169 +52,193 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
-		echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-    CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 lxc.cgroup2.devices.allow: c 188:* rwm

+ 181 - 157
ct/docker-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     ____             __            
    / __ \____  _____/ /_v4__  _____
   / / / / __ \/ ___/ //_/ _ \/ ___/
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	    echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-	    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-                echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-                VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -232,7 +256,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 EOF

+ 189 - 165
ct/emby-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${DGN}
+  echo -e "${DGN}
     ______          __         
    / ____/___ v4_  / /_  __  __
   / __/ / __  __ \/ __ \/ / / /
@@ -53,176 +53,200 @@ echo -e "${DGN}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
-		echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-    CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  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 3 \
-"18.04" "Bionic" OFF \
-"20.04" "Focal" ON \
-"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}"; 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
+  var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
+    "18.04" "Bionic" OFF \
+    "20.04" "Focal" ON \
+    "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}"; 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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -241,7 +265,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: c 226:0 rwm
 lxc.cgroup2.devices.allow: c 226:128 rwm
 lxc.cgroup2.devices.allow: c 29:0 rwm

+ 180 - 156
ct/emqx-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     ________  _______v4 _  __
    / ____/  |/  / __ \ | |/ /
   / __/ / /|_/ / / / / |   / 
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/esphome-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${CL}
+  echo -e "${CL}
     ___________ ____  __  ______  __  _________
    / ____/ ___// __ \/ / / / __ \/  |/  / ____/
   / __/  \__ \/ /_/ / /_/ / / / / /|_/ / __/   
@@ -52,168 +52,192 @@ echo -e "${CL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/grafana-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
    ______           ____                 
   / ____/________ _/ __/___ _____  ____ _
  / / __/ ___/ __  / /_/ __  / __ \/ __  /
@@ -52,168 +52,192 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/grocy-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
    ____ __________  _______  __
   / __  / ___/ __ \/ ___/ / / /
  / /_/ / /  / /_/ / /__/ /_/ / 
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/heimdalldashboard-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     __  __     _               __      ____   ____             __    __                         __
    / / / /__  (_)___ ___  ____/ /_v4 _/ / /  / __ \____ ______/ /_  / /_  ____  ____ __________/ /
   / /_/ / _ \/ / __  __ \/ __  / __  / / /  / / / / __  / ___/ __ \/ __ \/ __ \/ __  / ___/ __  / 
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 182 - 158
ct/homeassistant-core-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     __  __                        ___              _      __              __     ______              
    / / / /___  ____ ___  ___     /   |  __________(_)____/ /_____ _____  / /_   / ____/___v4________ 
   / /_/ / __ \/ __ `__ \/ _ \   / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/  / /   / __ \/ ___/ _ \
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,8 +257,8 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 if [ "$CT_TYPE" == "0" ]; then
-LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+  LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
+  cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 lxc.cgroup2.devices.allow: c 188:* rwm

+ 182 - 158
ct/homeassistant-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     __  __                        ___              _      __              __ 
    / / / /___  ____ ___  ___ v4  /   |  __________(_)____/ /_____ _____  / /_
   / /_/ / __ \/ __  __ \/ _ \   / /| | / ___/ ___/ / ___/ __/ __  / __ \/ __/
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
 if [ "$CT_TYPE" == "0" ]; then
-cat <<EOF >> $LXC_CONFIG
+  cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 lxc.cgroup2.devices.allow: c 188:* rwm
@@ -244,7 +268,7 @@ lxc.mount.entry: /dev/ttyACM0       dev/ttyACM0       none bind,optional,create=
 lxc.mount.entry: /dev/ttyACM1       dev/ttyACM1       none bind,optional,create=file
 EOF
 else
-cat <<EOF >> $LXC_CONFIG
+  cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 EOF

+ 180 - 156
ct/homebridge-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
     __  ______  __  _____________  ____  ________  ____________
    / / / / __ \/  |/  / ____/ __ )/ __ \/  _/ __ \/ ____/ ____/
   / /_/ / / / / /|_/ / __/ / __  / /_/ // // / / / / __/ __/   
@@ -52,168 +52,192 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/homepage-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     __  __                                          
    / / / /___  ____ ___  ___  ____  ____ _____ ____ 
   / /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/influxdb-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
     ____      ______           ____  ____ 
    /  _/_v4  / __/ /_  ___  __/ __ \/ __ )
    / // __ \/ /_/ / / / / |/_/ / / / __  |
@@ -52,168 +52,192 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/iobroker-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     _       ____             __            
    (_)___  / __ )_________  / /_____  _____
   / / __ \/ __  / ___/ __ \/ //_/ _ \/ ___/
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 190 - 166
ct/jellyfin-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${DGN}
+  echo -e "${DGN}
        __________    ____  _____________   __
       / / ____/ /   / /\ \/ / ____/  _/ | / /
  __  / / __/ / /   / /  \  / /_   / //  |/ / 
@@ -52,177 +52,201 @@ echo -e "${DGN}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
-		
-    echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-    CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
+
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  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 3 \
-"18.04" "Bionic" OFF \
-"20.04" "Focal" ON \
-"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}"; 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
+  var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
+    "18.04" "Bionic" OFF \
+    "20.04" "Focal" ON \
+    "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}"; 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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -241,7 +265,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: c 226:0 rwm
 lxc.cgroup2.devices.allow: c 226:128 rwm
 lxc.cgroup2.devices.allow: c 29:0 rwm

+ 180 - 156
ct/keycloak-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     __ __                __            __  
    / //_/__  __  _______/ /___  ____ _/ /__
   / ,< / _ \/ / / / ___/ / __ \/ __  / //_/
@@ -53,168 +53,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/magicmirror-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     __  ___            _      __  ____                     
    /  |/  /___ _____ _(_)____/  |/  (_)_____________  _____
   / /|_/ / __  / __  / / ___/ /|_/ / / ___/ ___/ __ \/ ___/
@@ -53,168 +53,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/mariadb-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     __  ___           _       ____  ____ 
    /  |/  /___ ______(_)___ _/ __ \/ __ )
   / /|_/ / __  / ___/ / __  / / / / __  |
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/meshcentral-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     __  ___          __    ______           __             __
    /  |/  /__  _____/ /_  / ____/__  ____  / /__________ _/ /
   / /|_/ / _ \/ ___/ __ \/ /   / _ \/ __ \/ __/ ___/ __  / / 
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/motioneye-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     __  ___      __  _             ________  ________
    /  |/  /___  / /_(_)___  ____  / ____/\ \/ / ____/
   / /|_/ / __ \/ __/ / __ \/ __ \/ __/    \  / __/   
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/n8n-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
          ___        
         / _ \       
   _ __ | (_) |_v4_  
@@ -53,168 +53,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/navidrome-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     _   __            _     __                        
    / | / /___ __ v4__(_)___/ /________  ____ ___  ___ 
   /  |/ / __  / | / / / __  / ___/ __ \/ __  __ \/ _ \
@@ -52,168 +52,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/nextcloudpi-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     _   __          __  ________                ______  _ 
    / | / /__  _  __/ /_/ ____/ /___  __v4______/ / __ \(_)
   /  |/ / _ \| |/_/ __/ /   / / __ \/ / / / __  / /_/ / / 
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-		CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/nginx-proxy-manager-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     _   __      _               ____                           __  ___                                 
    / | / /___ _(_)___  _  __   / __ \_________  _  ____  __   /  |/  /___ _____  ____ _____ ____  _____
   /  |/ / __  / / __ \| |/_/  / /_/ / ___/ __ \| |/_/ / / /  / /|_/ / __  / __ \/ __  / __  / _ \/ ___/
@@ -53,168 +53,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/nocodb-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
     _   __                 ____  ____ 
    / | / /___  ____v4___  / __ \/ __ )
   /  |/ / __ \/ ___/ __ \/ / / / __  |
@@ -52,168 +52,192 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/node-red-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     _   __          __        ____           __
    / | / /___  ____/ /__ v4  / __ \___  ____/ /
   /  |/ / __ \/ __  / _ \   / /_/ / _ \/ __  / 
@@ -52,168 +52,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 189 - 165
ct/omada-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
    ____                      __     
   / __ \____ ___v4____ _____/ /___ _
  / / / / __  __ \/ __  / __  / __  /
@@ -52,177 +52,201 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
-	    echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-	    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-        echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-        VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  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}"; 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
+  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}"; 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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 181 - 157
ct/omv-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
    ____                   __  ___         ___      _    __            ____ 
   / __ \____v4___  ____  /  |/  /__  ____/ (_)___ | |  / /___ ___  __/ / /_
  / / / / __ \/ _ \/ __ \/ /|_/ / _ \/ __  / / __ `/ | / / __ `/ / / / / __/
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-		CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop: 
 lxc.cgroup2.devices.allow: c 188:* rwm

+ 180 - 156
ct/openhab-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
                           __  _____    ____ 
   ____v4____  ___  ____  / / / /   |  / __ )
  / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
@@ -53,168 +53,192 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/paperless-ngx-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
     ____                        __                                     
    / __ \____ _____  ___  _____/ /__v4__________    ____  ____ __  __
   / /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/photoprism-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     ____  __  ______  __________  ____  ____  _________ __  ___
    / __ \/ / / / __ \/_  __/ __ \/ __ \/ __ \/  _/ ___//  |/  /
   / /_/ / /_/ / / / / / / / / / / /_/ / /_/ // / \__ \/ /|_/ / 
@@ -52,168 +52,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/pihole-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     ____  ____   __  ______  __    ______
    / __ \/  _/  / / / / __ \/ /   / ____/
   / /_/ // /___/ /_/ / / / / /   / __/   
@@ -52,168 +52,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-		CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 190 - 166
ct/plex-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
     ____  __         
    / __ \/ /__  _  __
   / /_/ / / _ \| |/_/
@@ -52,177 +52,201 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
-		
-    echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-    CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
+
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  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 3 \
-"18.04" "Bionic" OFF \
-"20.04" "Focal" ON \
-"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}"; 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
+  var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 3 \
+    "18.04" "Bionic" OFF \
+    "20.04" "Focal" ON \
+    "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}"; 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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -241,7 +265,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: c 226:0 rwm
 lxc.cgroup2.devices.allow: c 226:128 rwm
 lxc.cgroup2.devices.allow: c 29:0 rwm

+ 181 - 157
ct/podman-homeassistant-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
                      ____            __                                      
                     / __ \____  ____/ /___ ___  ____ _____                   
            v4      / /_/ / __ \/ __  / __  __ \/ __  / __ \                  
@@ -56,168 +56,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-    CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -236,7 +260,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 EOF

+ 180 - 156
ct/postgresql-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
     ____             __                 _____ ____    __ 
    / __ \____  _____/ /_____ _________ / ___// __ \  / / 
   / /_/ / __ \/ ___/ __/ __  / ___/ _ \\__ \/ / / / / /  
@@ -53,168 +53,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/prometheus-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
     ____                            __  __                   
    / __ \_________  ____ ___  ___  / /_/ /_  ___  __  _______
   / /_/ / ___/ __ \/ __  __ \/ _ \/ __/ __ \/ _ \/ / / / ___/
@@ -52,168 +52,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/syncthing-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
    _____                  __  __    _            
   / ___/__  ______v4_____/ /_/ /_  (_)___  ____ _
   \__ \/ / / / __ \/ ___/ __/ __ \/ / __ \/ __ `/
@@ -54,168 +54,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/technitiumdns-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
   ______          __          _ __  _                    ____  _   _______
  /_  __/__  _____/ /_  ____  (_) /_(_)_  ______ ___ v4  / __ \/ | / / ___/
   / / / _ \/ ___/ __ \/ __ \/ / __/ / / / / __  __ \   / / / /  |/ /\__ \ 
@@ -52,168 +52,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/trilium-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
   ______     _ ___               
  /_  __/_v4_(_) (_)_  ______ ___ 
   / / / ___/ / / / / / / __ `__ \
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 189 - 165
ct/ubuntu-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
    __  ____                __       
   / / / / /_v4__  ______  / /___  __
  / / / / __ \/ / / / __ \/ __/ / / /
@@ -52,177 +52,201 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-	    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-                echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-                VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using ${var_os} Version: ${BGN}${var_version}${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  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" OFF \
-"21.10" "Impish" OFF \
-"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}"; 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
+  var_version=$(whiptail --title "UBUNTU VERSION" --radiolist "Choose Version" 10 58 4 \
+    "18.04" "Bionic" OFF \
+    "20.04" "Focal" OFF \
+    "21.10" "Impish" OFF \
+    "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}"; 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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 181 - 157
ct/umbrel-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
    __  __          __              __
   / / / /___ ___v4/ /_  ________  / /
  / / / / __ `__ \/ __ \/ ___/ _ \/ / 
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	    echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-	    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-                echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-                VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 EOF

+ 180 - 156
ct/unifi-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
    __  __      _ _____ 
   / / / /_v4  (_) __(_)
  / / / / __ \/ / /_/ / 
@@ -52,168 +52,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/uptimekuma-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${DGN}
+  echo -e "${DGN}
    __  __      __  _                   __ __                     
   / / / /___  / /_(_)___ ___  ___ v4  / //_/_  ______ ___  ____ _
  / / / / __ \/ __/ / __  __ \/ _ \   / ,< / / / / __  __ \/ __  /
@@ -53,168 +53,192 @@ echo -e "${DGN}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/vaultwarden-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${CL}
+  echo -e "${CL}
  _    _____   __  ____  _______       _____    ____  ____  _______   __
 | |  / /   | / / / / / /_  __/ |     / /   |  / __ \/ __ \/ ____/ | / /
 | | / / /| |/ / / / /   / /  | | /| / / /| | / /_/ / / / / __/ /  |/ / 
@@ -52,168 +52,192 @@ echo -e "${CL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/whoogle-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${GN}
+  echo -e "${GN}
  _       ____  ______  ____  ________    ______
 | | v4  / / / / / __ \/ __ \/ ____/ /   / ____/
 | | /| / / /_/ / / / / / / / / __/ /   / __/   
@@ -52,168 +52,192 @@ echo -e "${GN}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/wikijs-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
  _       ___ __   _     _     
 | |     / (_) /__(_)   (_)____
 | | /| / / / //_/ /   / / ___/
@@ -53,168 +53,192 @@ echo -e "${BL}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-		CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 180 - 156
ct/wireguard-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${RD}
+  echo -e "${RD}
  __          ___           _____                     _ 
  \ \        / (_)         / ____|                   | |
   \ \  /\  / / _ _ __ ___| |  __ _   _  __ _ _ __ __| |
@@ -54,168 +54,192 @@ echo -e "${RD}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	    echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
-	    CT_TYPE="1"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-        echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-        VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Unprivileged${CL} ${RD}NO DEVICE PASSTHROUGH${CL}"
+  CT_TYPE="1"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID

+ 181 - 157
ct/zigbee2mqtt-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-echo -e "${YW}
+  echo -e "${YW}
  _____   _       __             ___   __  _______  ____________
 /__  /  (_)___ _/ /_  ___  ___ |__ \ /  |/  / __ \/_  __/_  __/
   / /  / / __  / __ \/ _ \/ _ \__/ // /|_/ / / / / / /   / /   
@@ -53,168 +53,192 @@ echo -e "${YW}
 ${CL}"
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-	    echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-	    CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-        echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-        VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop: 
 lxc.cgroup2.devices.allow: c 188:* rwm

+ 181 - 157
ct/zwave-js-ui-v4.sh

@@ -10,13 +10,13 @@ NSAPP=$(echo ${APP,,} | tr -d ' ')
 var_install="${NSAPP}-install"
 NEXTID=$(pvesh get /cluster/nextid)
 INTEGER='^[0-9]+$'
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -36,14 +36,14 @@ function error_exit() {
   exit $EXIT
 }
 if (whiptail --title "${APP} LXC" --yesno "This will create a New ${APP} LXC. Proceed?" 10 58); then
-    echo "User selected Yes"
+  echo "User selected Yes"
 else
-    clear
-    echo -e "⚠ User exited script \n"
-    exit
+  clear
+  echo -e "⚠ User exited script \n"
+  exit
 fi
 function header_info {
-cat << "EOF"
+  cat <<"EOF"
  _____                                  _______    __  ______
 /__  /_      ______ __v4 _____         / / ___/   / / / /  _/
   / /| | /| / / __ `/ | / / _ \   __  / /\__ \   / / / // /  
@@ -53,168 +53,192 @@ cat << "EOF"
 EOF
 }
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 function PVE_CHECK() {
-    PVE=$(pveversion | grep "pve-manager/7" | wc -l)
-if [[ $PVE != 1 ]]; then
-   echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
-   echo -e "Exiting..."
-   sleep 2
-   exit
-fi
+  PVE=$(pveversion | grep "pve-manager/7" | wc -l)
+  if [[ $PVE != 1 ]]; then
+    echo -e "${RD}This script requires Proxmox Virtual Environment 7.0 or greater${CL}"
+    echo -e "Exiting..."
+    sleep 2
+    exit
+  fi
 }
 function default_settings() {
-		echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
-		CT_TYPE="0"
-		echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
-		PW=""
-		echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
-		CT_ID=$NEXTID
-		echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
-		HN=$NSAPP
-		echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
-		DISK_SIZE="$var_disk"
-		echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
-		CORE_COUNT="$var_cpu"
-		echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
-		RAM_SIZE="$var_ram"
-		echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
-		BRG="vmbr0"
-		echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
-		NET=dhcp
-		echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
-		GATE=""
-		echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
-		MAC=""
-    echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
-    VLAN=""
-		echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
+  echo -e "${DGN}Using Container Type: ${BGN}Privileged${CL}"
+  CT_TYPE="0"
+  echo -e "${DGN}Using Root Password: ${BGN}Automatic Login${CL}"
+  PW=""
+  echo -e "${DGN}Using Container ID: ${BGN}$NEXTID${CL}"
+  CT_ID=$NEXTID
+  echo -e "${DGN}Using Hostname: ${BGN}$NSAPP${CL}"
+  HN=$NSAPP
+  echo -e "${DGN}Using Disk Size: ${BGN}$var_disk${CL}${DGN}GB${CL}"
+  DISK_SIZE="$var_disk"
+  echo -e "${DGN}Allocated Cores ${BGN}$var_cpu${CL}"
+  CORE_COUNT="$var_cpu"
+  echo -e "${DGN}Allocated Ram ${BGN}$var_ram${CL}"
+  RAM_SIZE="$var_ram"
+  echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
+  BRG="vmbr0"
+  echo -e "${DGN}Using Static IP Address: ${BGN}dhcp${CL}"
+  NET=dhcp
+  echo -e "${DGN}Using Gateway Address: ${BGN}Default${CL}"
+  GATE=""
+  echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
+  MAC=""
+  echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
+  VLAN=""
+  echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
 function advanced_settings() {
-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
+  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}"
-fi
-PW1=$(whiptail --inputbox "Set Root Password" 8 58  --title "PASSWORD(leave blank for automatic login)" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $PW1 ]; then PW1="Automatic Login" PW=" ";
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
-else
-    PW="-password $PW1"
-    echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
   fi
-fi
-CT_ID=$(whiptail --inputbox "Set Container ID" 8 58 $NEXTID --title "CONTAINER ID" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_ID ]; then CT_ID="$NEXTID"; echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CT_NAME ]; then HN="$NSAPP"; echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-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;
-fi
-CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $CORE_COUNT ]; then CORE_COUNT="$var_cpu"; echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $RAM_SIZE ]; then RAM_SIZE="$var_ram"; echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}";
-else
-  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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $BRG ]; then BRG="vmbr0"; echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi;
-fi
-NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ -z $NET ]; then NET="dhcp"; echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}";
-else
-  if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi;
-fi
-GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58  --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $GATE1 ]; then GATE1="Default" GATE="";
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
-else
-    GATE=",gw=$GATE1"
-    echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+  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=" "
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    else
+      PW="-password $PW1"
+      echo -e "${DGN}Using Root Password: ${BGN}$PW1${CL}"
+    fi
   fi
-fi
-MAC1=$(whiptail --inputbox "Set a MAC Address(leave blank for default)" 8 58  --title "MAC ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $MAC1 ]; then MAC1="Default" MAC="";
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
-else
-    MAC=",hwaddr=$MAC1"
-    echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+  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 [ -z $CT_ID ]; then
+    CT_ID="$NEXTID"
+    echo -e "${DGN}Container ID: ${BGN}$CT_ID${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Container ID: ${BGN}$CT_ID${CL}"; fi
   fi
-fi
-VLAN1=$(whiptail --inputbox "Set a Vlan(leave blank for default)" 8 58  --title "VLAN" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
-exitstatus=$?
-if [ $exitstatus = 0 ]; then
-  if [ -z $VLAN1 ]; then VLAN1="Default" VLAN="";
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-else
-    VLAN=",tag=$VLAN1"
-    echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
-  fi  
-fi
-if (whiptail --title "ADVANCED SETTINGS COMPLETE" --yesno "Ready to create ${APP} LXC?" --no-button Do-Over 10 58); then
+  CT_NAME=$(whiptail --inputbox "Set Hostname" 8 58 $NSAPP --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CT_NAME ]; then
+    HN="$NSAPP"
+    echo -e "${DGN}Using Hostname: ${BGN}$HN${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  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
+  fi
+  CORE_COUNT=$(whiptail --inputbox "Allocate CPU Cores" 8 58 $var_cpu --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $CORE_COUNT ]; then
+    CORE_COUNT="$var_cpu"
+    echo -e "${DGN}Allocated Cores: ${BGN}$CORE_COUNT${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $RAM_SIZE ]; then
+    RAM_SIZE="$var_ram"
+    echo -e "${DGN}Allocated RAM: ${BGN}$RAM_SIZE${CL}"
+  else
+    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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $BRG ]; then
+    BRG="vmbr0"
+    echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using Bridge: ${BGN}$BRG${CL}"; fi
+  fi
+  NET=$(whiptail --inputbox "Set a Static IPv4 CIDR Address(/24)" 8 58 dhcp --title "IP ADDRESS" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ -z $NET ]; then
+    NET="dhcp"
+    echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"
+  else
+    if [ $exitstatus = 0 ]; then echo -e "${DGN}Using IP Address: ${BGN}$NET${CL}"; fi
+  fi
+  GATE1=$(whiptail --inputbox "Set a Gateway IP (mandatory if Static IP was used)" 8 58 --title "GATEWAY IP" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $GATE1 ]; then
+      GATE1="Default" GATE=""
+      echo -e "${DGN}Using Gateway IP Address: ${BGN}$GATE1${CL}"
+    else
+      GATE=",gw=$GATE1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $MAC1 ]; then
+      MAC1="Default" MAC=""
+      echo -e "${DGN}Using MAC Address: ${BGN}$MAC1${CL}"
+    else
+      MAC=",hwaddr=$MAC1"
+      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" --cancel-button Exit-Script 3>&1 1>&2 2>&3)
+  exitstatus=$?
+  if [ $exitstatus = 0 ]; then
+    if [ -z $VLAN1 ]; then
+      VLAN1="Default" VLAN=""
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    else
+      VLAN=",tag=$VLAN1"
+      echo -e "${DGN}Using Vlan: ${BGN}$VLAN1${CL}"
+    fi
+  fi
+  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
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  else
+    clear
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 function start_script() {
-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
-else
-  header_info
-  echo -e "${RD}Using Advanced Settings${CL}"
-  advanced_settings
-fi
+  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
+  else
+    header_info
+    echo -e "${RD}Using Advanced Settings${CL}"
+    advanced_settings
+  fi
 }
 clear
 start_script
-if [ "$CT_TYPE" == "1" ]; then 
- FEATURES="nesting=1,keyctl=1"
- else
- FEATURES="nesting=1"
- fi
+if [ "$CT_TYPE" == "1" ]; then
+  FEATURES="nesting=1,keyctl=1"
+else
+  FEATURES="nesting=1"
+fi
 TEMP_DIR=$(mktemp -d)
 pushd $TEMP_DIR >/dev/null
 export CTID=$CT_ID
@@ -233,7 +257,7 @@ export PCT_OPTIONS="
 "
 bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $LXC_CONFIG
+cat <<EOF >>$LXC_CONFIG
 lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 lxc.cgroup2.devices.allow: c 188:* rwm

+ 7 - 7
misc/add-tailscale-lxc.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 echo -e "\e[1;33mThis script will add Tailscale to an existing LXC Container ONLY\e[0m"
 while true; do
-    read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 
 set -o errexit
@@ -32,7 +32,7 @@ function msg() {
 
 CTID=$1
 CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
-cat <<EOF >> $CTID_CONFIG_PATH
+cat <<EOF >>$CTID_CONFIG_PATH
 lxc.cgroup2.devices.allow: c 10:200 rwm
 lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
 EOF

+ 21 - 21
misc/code-server.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 IP=$(hostname -I | awk '{print $1}')
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -21,25 +21,25 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
 
 function error_exit() {
-  trap - ERR
-  local reason="Unknown failure occured."
-  local msg="${1:-$reason}"
-  local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
-  echo -e "$flag $msg" 1>&2
-  exit $EXIT
+    trap - ERR
+    local reason="Unknown failure occured."
+    local msg="${1:-$reason}"
+    local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
+    echo -e "$flag $msg" 1>&2
+    exit $EXIT
 }
 
 while true; do
     read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${BL}
+    echo -e "${BL}
    ______          __        _____                          
   / ____/___  ____/ /__     / ___/___  ______   _____  _____
  / /   / __ \/ __  / _ \    \__ \/ _ \/ ___/ | / / _ \/ ___/
@@ -66,9 +66,9 @@ apt-get install -y sudo &>/dev/null
 apt-get install -y git &>/dev/null
 msg_ok "Installed Dependencies"
 
-VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 3, length($2)-4) }') \
+VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest |
+    grep "tag_name" |
+    awk '{print substr($2, 3, length($2)-4) }')
 
 msg_info "Installing Code-Server v${VERSION}"
 curl -fOL https://github.com/coder/code-server/releases/download/v$VERSION/code-server_${VERSION}_amd64.deb &>/dev/null
@@ -76,7 +76,7 @@ sudo dpkg -i code-server_${VERSION}_amd64.deb &>/dev/null
 rm -rf code-server_${VERSION}_amd64.deb
 mkdir -p ~/.config/code-server/
 sudo systemctl enable --now code-server@$USER &>/dev/null
-cat <<EOF > ~/.config/code-server/config.yaml
+cat <<EOF >~/.config/code-server/config.yaml
 bind-addr: 0.0.0.0:8680
 auth: none
 password: 

+ 20 - 15
misc/container-restore-from-backup.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 clear
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -15,14 +15,14 @@ APP="Home Assistant Container"
 while true; do
     read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-cat << "EOF"
+    cat <<"EOF"
     __  __                        ___              _      __              __              
    / / / /___  ____ ___  ___     /   |  __________(_)____/ /_____ _____  / /_   
   / /_/ / __ \/ __ `__ \/ _ \   / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/  
@@ -46,10 +46,12 @@ function msg_error() {
     local msg="$1"
     echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 }
-if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then msg_error "No backups found! \n"; exit 1; fi
+if [ -z "$(ls -A /var/lib/docker/volumes/hass_config/_data/backups/)" ]; then
+    msg_error "No backups found! \n"
+    exit 1
+fi
 DIR=/var/lib/docker/volumes/hass_config/_data/restore
-if [ -d "$DIR" ];
-then
+if [ -d "$DIR" ]; then
     msg_ok "Restore Directory Exists."
 else
     mkdir -p /var/lib/docker/volumes/hass_config/_data/restore
@@ -58,7 +60,10 @@ fi
 cd /var/lib/docker/volumes/hass_config/_data/backups/
 PS3="Please enter your choice: "
 files="$(ls -A .)"
-select filename in ${files}; do msg_ok "You selected ${BL}${filename}${CL}"; break; done
+select filename in ${files}; do
+    msg_ok "You selected ${BL}${filename}${CL}"
+    break
+done
 msg_info "Stopping Home Assistant"
 docker stop homeassistant &>/dev/null
 msg_ok "Stopped Home Assistant"

+ 20 - 15
misc/core-restore-from-backup.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 clear
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -15,14 +15,14 @@ APP="Home Assistant Core"
 while true; do
     read -p "This will restore ${APP} from a backup. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-cat << "EOF"
+    cat <<"EOF"
     __  __                        ___              _      __              __     ______              
    / / / /___  ____ ___  ___     /   |  __________(_)____/ /_____ _____  / /_   / ____/___  ________ 
   / /_/ / __ \/ __ `__ \/ _ \   / /| | / ___/ ___/ / ___/ __/ __ `/ __ \/ __/  / /   / __ \/ ___/ _ \
@@ -46,10 +46,12 @@ function msg_error() {
     local msg="$1"
     echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 }
-if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then msg_error "No backups found! \n"; exit 1; fi
+if [ -z "$(ls -A /root/.homeassistant/backups/)" ]; then
+    msg_error "No backups found! \n"
+    exit 1
+fi
 DIR=/root/.homeassistant/restore
-if [ -d "$DIR" ];
-then
+if [ -d "$DIR" ]; then
     msg_ok "Restore Directory Exists."
 else
     mkdir -p /root/.homeassistant/restore
@@ -58,7 +60,10 @@ fi
 cd /root/.homeassistant/backups/
 PS3="Please enter your choice: "
 files="$(ls -A .)"
-select filename in ${files}; do msg_ok "You selected ${BL}${filename}${CL}"; break; done
+select filename in ${files}; do
+    msg_ok "You selected ${BL}${filename}${CL}"
+    break
+done
 msg_info "Stopping Home Assistant"
 sudo service homeassistant stop
 msg_ok "Stopped Home Assistant"

+ 17 - 17
misc/crowdsec.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -20,25 +20,25 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
 
 function error_exit() {
-  trap - ERR
-  local reason="Unknown failure occured."
-  local msg="${1:-$reason}"
-  local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
-  echo -e "$flag $msg" 1>&2
-  exit $EXIT
+    trap - ERR
+    local reason="Unknown failure occured."
+    local msg="${1:-$reason}"
+    local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
+    echo -e "$flag $msg" 1>&2
+    exit $EXIT
 }
 
 while true; do
     read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${BL}
+    echo -e "${BL}
    _____                      _  _____           
   / ____|                    | |/ ____|          
  | |     _ __ _____      ____| | (___   ___  ___ 

+ 9 - 9
misc/dashy-update.sh

@@ -1,23 +1,23 @@
 #!/usr/bin/env bash
 set -e
 clear
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 while true; do
     read -p "This will Update Dashy LXC. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${RD}
+    echo -e "${RD}
   _____            _           
  |  __ \          | |          
  | |  | | __ _ ___| |__  _   _ 

+ 98 - 91
misc/edge-kernel.sh

@@ -2,26 +2,26 @@
 # bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/misc/edge-kernel.sh)"
 set -e
 KERNEL_ON=$(uname -r)
-PVE_KERNEL=$(dpkg --list| grep 'kernel-.*-pve' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
-EDGE_KERNEL=$(dpkg --list| grep 'kernel-.*-edge' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
+PVE_KERNEL=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
+EDGE_KERNEL=$(dpkg --list | grep 'kernel-.*-edge' | awk '{print substr($2, 12, length($2)-1) }' | tac | head -n 1)
 clear
 while true; do
     read -p "This is a Proxmox Edge Kernel Tool, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 
-show_menu(){
-    normal=`echo "\033[m"`
-    safe=`echo "\033[32m"`
-    menu=`echo "\033[36m"`
-    number=`echo "\033[33m"`
-    bgred=`echo "\033[41m"`
-    fgred=`echo "\033[31m"`
+show_menu() {
+    normal=$(echo "\033[m")
+    safe=$(echo "\033[32m")
+    menu=$(echo "\033[36m")
+    number=$(echo "\033[33m")
+    bgred=$(echo "\033[41m")
+    fgred=$(echo "\033[31m")
     proxmox-boot-tool kernel list
     echo -e "\nCurrent Kernel: ${menu}${KERNEL_ON}${normal}"
     printf "\n${menu}*********************************************${normal}\n"
@@ -34,106 +34,113 @@ show_menu(){
     printf "Please choose an option from the menu and enter or ${fgred}x${normal} to exit."
     read opt
 }
-option_picked(){
-    msgcolor=`echo "\033[01;31m"`
-    normal=`echo "\033[00;00m"`
+option_picked() {
+    msgcolor=$(echo "\033[01;31m")
+    normal=$(echo "\033[00;00m")
     message=${@:-"${normal}Error: No message passed"}
     printf "${msgcolor}${message}${normal}\n"
 }
 clear
 show_menu
-while [ $opt != '' ]
-    do
+while [ $opt != '' ]; do
     if [ $opt = '' ]; then
-      exit;
+        exit
     else
-      case $opt in
-        1) while true; do
-            read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
-            case $yn in
-            [Yy]* ) break;;
-            [Nn]* ) exit;;
-                * ) echo "Please answer yes or no.";;
-            esac
-           done
-           clear;
-            option_picked "Installing Proxmox Edge Kernel & Rebooting";
+        case $opt in
+        1)
+            while true; do
+                read -p "Are you sure you want to Install Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
+                case $yn in
+                [Yy]*) break ;;
+                [Nn]*) exit ;;
+                *) echo "Please answer yes or no." ;;
+                esac
+            done
+            clear
+            option_picked "Installing Proxmox Edge Kernel & Rebooting"
             apt-get install -y gnupg
             curl -1sLf 'https://dl.cloudsmith.io/public/pve-edge/kernel/gpg.8EC01CCF309B98E7.key' | apt-key add -
-            echo "deb https://dl.cloudsmith.io/public/pve-edge/kernel/deb/debian bullseye main" > /etc/apt/sources.list.d/pve-edge-kernel.list
+            echo "deb https://dl.cloudsmith.io/public/pve-edge/kernel/deb/debian bullseye main" >/etc/apt/sources.list.d/pve-edge-kernel.list
             apt-get -y update
             apt-get -y install pve-kernel-5.19-edge
             reboot
-            break;
-        ;;
-        2) while true; do
-            read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn
-            case $yn in
-            [Yy]* ) break;;
-            [Nn]* ) exit;;
-                * ) echo "Please answer yes or no.";;
-            esac
-           done
-           clear;
-            option_picked "Switching to Proxmox VE 7 Kernel & Rebooting";
+            break
+            ;;
+        2)
+            while true; do
+                read -p "Are you sure you want to Switch to Proxmox VE 7 ${PVE_KERNEL} Kernel & Reboot? Proceed(y/n)?" yn
+                case $yn in
+                [Yy]*) break ;;
+                [Nn]*) exit ;;
+                *) echo "Please answer yes or no." ;;
+                esac
+            done
+            clear
+            option_picked "Switching to Proxmox VE 7 Kernel & Rebooting"
             proxmox-boot-tool kernel pin ${PVE_KERNEL}
             reboot
-            break;
-        ;;
-        3) while true; do
-            read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn
-            case $yn in
-            [Yy]* ) break;;
-            [Nn]* ) exit;;
-                * ) echo "Please answer yes or no.";;
-            esac
-           done
-           clear;
-            option_picked "Switching to Proxmox Edge Kernel & Rebooting";
+            break
+            ;;
+        3)
+            while true; do
+                read -p "Are you sure you want to Switch to Proxmox ${EDGE_KERNEL} Edge Kernel & Reboot? Proceed(y/n)?" yn
+                case $yn in
+                [Yy]*) break ;;
+                [Nn]*) exit ;;
+                *) echo "Please answer yes or no." ;;
+                esac
+            done
+            clear
+            option_picked "Switching to Proxmox Edge Kernel & Rebooting"
             proxmox-boot-tool kernel pin ${EDGE_KERNEL}
             reboot
-            break;
-        ;;
-        4) while true; do
-            read -p "Are you sure you want to Unpin the Current Kernel? Proceed(y/n)?" yn
-            case $yn in
-            [Yy]* ) break;;
-            [Nn]* ) exit;;
-                * ) echo "Please answer yes or no.";;
-            esac
-           done
-           clear;
-            option_picked "Unpinning Current Kernel";
+            break
+            ;;
+        4)
+            while true; do
+                read -p "Are you sure you want to Unpin the Current Kernel? Proceed(y/n)?" yn
+                case $yn in
+                [Yy]*) break ;;
+                [Nn]*) exit ;;
+                *) echo "Please answer yes or no." ;;
+                esac
+            done
+            clear
+            option_picked "Unpinning Current Kernel"
             proxmox-boot-tool kernel unpin
-            clear;
-            break;
-        ;;
-        5) while true; do
-            read -p "Are you sure you want to Remove Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
-            case $yn in
-            [Yy]* ) break;;
-            [Nn]* ) exit;;
-                * ) echo "Please answer yes or no.";;
-            esac
-           done
-           clear;
-            option_picked "Removing Proxmox Edge Kernel & Rebooting";
+            clear
+            break
+            ;;
+        5)
+            while true; do
+                read -p "Are you sure you want to Remove Proxmox Edge Kernel & Reboot? Proceed(y/n)?" yn
+                case $yn in
+                [Yy]*) break ;;
+                [Nn]*) exit ;;
+                *) echo "Please answer yes or no." ;;
+                esac
+            done
+            clear
+            option_picked "Removing Proxmox Edge Kernel & Rebooting"
             apt-get purge -y ${EDGE_KERNEL}
             rm -rf /etc/apt/sources.list.d/pve-edge-kernel.list
             proxmox-boot-tool kernel unpin
             reboot
-            break;
-        ;;
-        x)exit;
-        ;;
-        \n)exit;
-        ;;
-        *)clear;
-            option_picked "Please choose an option from the menu";
-            show_menu;
-        ;;
-      esac
+            break
+            ;;
+        x)
+            exit
+            ;;
+        \n)
+            exit
+            ;;
+        *)
+            clear
+            option_picked "Please choose an option from the menu"
+            show_menu
+            ;;
+        esac
     fi
-  done
+done
 
 show_menu

+ 11 - 11
misc/emby-update.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 LATEST=$(curl -sL https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -14,14 +14,14 @@ APP="Emby"
 while true; do
     read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-cat << "EOF"
+    cat <<"EOF"
     ______          __         
    / ____/___ ___  / /_  __  __
   / __/ / __  __ \/ __ \/ / / /

+ 18 - 18
misc/filebrowser.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 IP=$(hostname -I | awk '{print $1}')
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -21,25 +21,25 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
 
 function error_exit() {
-  trap - ERR
-  local reason="Unknown failure occured."
-  local msg="${1:-$reason}"
-  local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
-  echo -e "$flag $msg" 1>&2
-  exit $EXIT
+    trap - ERR
+    local reason="Unknown failure occured."
+    local msg="${1:-$reason}"
+    local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
+    echo -e "$flag $msg" 1>&2
+    exit $EXIT
 }
 
 while true; do
     read -p "This will Install ${APP} on $hostname. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${DGN}
+    echo -e "${DGN}
 
   ______ _ _      ____                                  
  |  ____(_) |    |  _ \                                 
@@ -81,7 +81,7 @@ WorkingDirectory=/root/
 ExecStart=/usr/local/bin/filebrowser -r /
 
 [Install]
-WantedBy=default.target" > $service_path
+WantedBy=default.target" >$service_path
 
 systemctl enable --now filebrowser.service &>/dev/null
 msg_ok "Created Service"

+ 8 - 8
misc/frigate-support.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 echo -e "\e[1;33m This script will Prepare a LXC Container for Frigate \e[0m"
 while true; do
-    read -p "Did you replace 106 with your LXC ID? Proceed (y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Did you replace 106 with your LXC ID? Proceed (y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -48,7 +48,7 @@ for char_dev in ${CHAR_DEVS[@]}; do
   CHAR_DEV_STRING+=" -regex \".*/${char_dev}\""
 done
 
-read -r -d '' HOOK_SCRIPT <<- EOF || true
+read -r -d '' HOOK_SCRIPT <<-EOF || true
 for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do
   dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)";
   mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev});
@@ -66,7 +66,7 @@ CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
 sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf
 cat CTID.conf >$CTID_CONFIG_PATH
 
-cat <<EOF >> $CTID_CONFIG_PATH
+cat <<EOF >>$CTID_CONFIG_PATH
 lxc.autodev: 1
 lxc.hook.autodev: bash -c '$HOOK_SCRIPT'
 EOF

+ 22 - 22
misc/ha-copy-data-podman.sh

@@ -3,12 +3,12 @@
 # run from the Proxmox Shell
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/ha-copy-data-podman.sh)"
 while true; do
-    read -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from a Home Assistant LXC to a Podman Home Assistant LXC. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -58,28 +58,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Podman LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Podman LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.02.12" 13 50 || exit
 info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
@@ -90,13 +90,13 @@ fi
 msg "Mounting Container Disks..."
 DOCKER_PATH=/var/lib/docker/volumes/hass_config/
 PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] ||
   die "Home Assistant directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${PODMAN_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${PODMAN_PATH}" ] ||
   die "Home Assistant directories in '$CTID_TO' not found."
 
 rm -rf ${CTID_TO_PATH}${PODMAN_PATH}

+ 22 - 22
misc/ha-copy-data.sh

@@ -3,12 +3,12 @@
 # run from the Proxmox Shell
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/ha-copy-data.sh)"
 while true; do
-    read -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from one Home Assistant LXC to another. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -58,28 +58,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.01.23" 13 50 || exit
 info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
@@ -89,13 +89,13 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then
 fi
 msg "Mounting Container Disks..."
 DOCKER_PATH=/var/lib/docker/volumes/hass_config/
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] ||
   die "Home Assistant directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] ||
   die "Home Assistant directories in '$CTID_TO' not found."
 
 rm -rf ${CTID_TO_PATH}${DOCKER_PATH}

+ 22 - 22
misc/hacontainer2hacore-data.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
 while true; do
-    read -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from a Home Assistant Container LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -55,28 +55,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Container LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Container LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Core LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Core LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.10.02" 13 50 || exit
 info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
@@ -87,13 +87,13 @@ fi
 msg "Mounting Container Disks..."
 DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
 CORE_PATH=/root/.homeassistant
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${DOCKER_PATH}" ] ||
   die "Home Assistant directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${CORE_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${CORE_PATH}" ] ||
   die "Home Assistant directories in '$CTID_TO' not found."
 
 msg "Copying Data..."

+ 22 - 22
misc/hacore2hacontainer-data.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
 while true; do
-    read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Container LXC. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -55,28 +55,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Core LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Core LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Container LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Container LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.10.02" 13 50 || exit
 info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
@@ -87,13 +87,13 @@ fi
 msg "Mounting Container Disks..."
 DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
 CORE_PATH=/root/.homeassistant
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] ||
   die "Home Assistant directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] ||
   die "Home Assistant directories in '$CTID_TO' not found."
 
 msg "Copying Data..."

+ 22 - 22
misc/hacore2hacore-data.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 clear
 while true; do
-    read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from a Home Assistant Core LXC to a Home Assistant Core LXC. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -51,28 +51,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Core LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Core LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Core LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Core LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.10.03" 13 50 || exit
 info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
@@ -83,13 +83,13 @@ fi
 msg "Mounting Container Disks..."
 DOCKER_PATH=/var/lib/docker/volumes/hass_config/_data
 CORE_PATH=/root/.homeassistant
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${CORE_PATH}" ] ||
   die "Home Assistant directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${CORE_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${CORE_PATH}" ] ||
   die "Home Assistant directories in '$CTID_TO' not found."
 
 msg "Copying Data..."

+ 3 - 3
misc/hacs-core.sh

@@ -4,9 +4,9 @@ echo -e "\e[1;33m This script will install Home Assistant Community Store (HACS)
 while true; do
     read -p "Start the HACS Install Script (y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 

+ 3 - 3
misc/hacs.sh

@@ -4,9 +4,9 @@ echo -e "\e[1;33m This script will install Home Assistant Community Store (HACS)
 while true; do
     read -p "Start the HACS Install Script (y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 

+ 23 - 24
misc/heimdalldashboard-all-update.sh

@@ -1,22 +1,22 @@
 #!/usr/bin/env bash
 set -e
-PP=`echo "\e[1;35m"`
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+PP=$(echo "\e[1;35m")
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 while true; do
-    read -p "This will Update Heimdall Dashboard. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "This will Update Heimdall Dashboard. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 clear
 function header_info {
-echo -e "${PP}
+  echo -e "${PP}
   _    _      _               _       _ _   _____            _     _                         _ 
  | |  | |    (_)             | |     | | | |  __ \          | |   | |                       | |
  | |__| | ___ _ _ __ ___   __| | __ _| | | | |  | | __ _ ___| |__ | |__   ___   __ _ _ __ __| |
@@ -39,13 +39,13 @@ echo -en "${GN} Backing up Data... "
 if [ -d "/opt/Heimdall-2.4.6" ]; then
   cp -R /opt/Heimdall-2.4.6/database database-backup
   cp -R /opt/Heimdall-2.4.6/public public-backup
-  elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
+elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
   cp -R /opt/Heimdall-2.4.7b/database database-backup
   cp -R /opt/Heimdall-2.4.7b/public public-backup
-  elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
+elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
   cp -R /opt/Heimdall-2.4.8/database database-backup
   cp -R /opt/Heimdall-2.4.8/public public-backup
-  else
+else
   cp -R /opt/Heimdall/database database-backup
   cp -R /opt/Heimdall/public public-backup
 fi
@@ -56,13 +56,13 @@ RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/Heimdall/releas
 echo -en "${GN} Updating Heimdall Dashboard to ${RELEASE}... "
 curl --silent -o ${RELEASE}.tar.gz -L "https://github.com/linuxserver/Heimdall/archive/${RELEASE}.tar.gz" &>/dev/null
 tar xvzf ${RELEASE}.tar.gz &>/dev/null
-VER=$(curl -s https://api.github.com/repos/linuxserver/Heimdall/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 3, length($2)-4) }')
+VER=$(curl -s https://api.github.com/repos/linuxserver/Heimdall/releases/latest |
+  grep "tag_name" |
+  awk '{print substr($2, 3, length($2)-4) }')
 
 if [ ! -d "/opt/Heimdall" ]; then
-  mv Heimdall-${VER} /opt/Heimdall  
-  else
+  mv Heimdall-${VER} /opt/Heimdall
+else
   cp -R Heimdall-${VER}/* /opt/Heimdall
 fi
 echo -e "${CM}${CL} \r"
@@ -82,7 +82,7 @@ ExecStart="/usr/bin/php" artisan serve --port 7990 --host 0.0.0.0
 TimeoutStopSec=30
 
 [Install]
-WantedBy=multi-user.target" > $service_path
+WantedBy=multi-user.target" >$service_path
 
 echo -en "${GN} Restoring Data... "
 cp -R database-backup/* /opt/Heimdall/database
@@ -94,10 +94,10 @@ echo -en "${GN} Cleanup... "
 if [ -d "/opt/Heimdall-2.4.6" ]; then
   rm -rf /opt/Heimdall-2.4.6
   rm -rf /opt/v2.4.6.tar.gz
-  elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
+elif [[ -d "/opt/Heimdall-2.4.7b" ]]; then
   rm -rf /opt/Heimdall-2.4.7b
   rm -rf /opt/v2.4.7b.tar.gz
-  elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
+elif [[ -d "/opt/Heimdall-2.4.8" ]]; then
   rm -rf /opt/Heimdall-2.4.8
   rm -rf /opt/v2.4.8.tar.gz
 fi
@@ -116,4 +116,3 @@ sleep 2
 echo -e "${CM}${CL} \r"
 
 echo -en "${GN} Finished! ${CL}\n"
-

+ 20 - 20
misc/homepage-update.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -19,25 +19,25 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
 
 function error_exit() {
-  trap - ERR
-  local reason="Unknown failure occured."
-  local msg="${1:-$reason}"
-  local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
-  echo -e "$flag $msg" 1>&2
-  exit $EXIT
+    trap - ERR
+    local reason="Unknown failure occured."
+    local msg="${1:-$reason}"
+    local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
+    echo -e "$flag $msg" 1>&2
+    exit $EXIT
 }
 
 while true; do
     read -p "This will Update ${APP}. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-cat << "EOF"
+    cat <<"EOF"
     __  __                                          
    / / / /___  ____ ___  ___  ____  ____ _____ ____ 
   / /_/ / __ \/ __ `__ \/ _ \/ __ \/ __ `/ __ `/ _ \
@@ -61,10 +61,10 @@ function msg_ok() {
 
 msg_info "Updating ${APP}"
 if ! command -v pnpm >/dev/null 2>&1; then
-  npm install -g pnpm &>/dev/null
+    npm install -g pnpm &>/dev/null
 fi
-cd /opt/homepage 
-systemctl stop homepage 
+cd /opt/homepage
+systemctl stop homepage
 git pull --force &>/dev/null
 pnpm install &>/dev/null
 pnpm build &>/dev/null

+ 51 - 52
misc/kernel-clean.sh

@@ -1,13 +1,13 @@
 #!/usr/bin/env bash -ex
 set -euo pipefail
 shopt -s inherit_errexit nullglob
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -18,15 +18,15 @@ current_kernel=$(uname -r)
 while true; do
     read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo -e "${RD}Please answer y/n${CL}";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo -e "${RD}Please answer y/n${CL}" ;;
     esac
 done
 clear
 
 function header_info {
-echo -e "${RD}
+    echo -e "${RD}
   _  __                    _    _____ _                  
  | |/ /                   | |  / ____| |                 
  |   / ___ _ __ _ __   ___| | | |    | | ___  __ _ _ __  
@@ -48,29 +48,29 @@ function msg_ok() {
 }
 
 function check_root() {
-        if [[ $EUID -ne 0 ]]; then
-                echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}" 
-                exit 1
-        else
-            header_info
-            edge_kernel
-            kernel_info
-            kernel_clean
-        fi
+    if [[ $EUID -ne 0 ]]; then
+        echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}"
+        exit 1
+    else
+        header_info
+        edge_kernel
+        kernel_info
+        kernel_clean
+    fi
 }
 
 function edge_kernel() {
     if [[ "$current_kernel" == *"edge"* ]]; then
-         echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active"
-         echo -e "\nAn Active PVE Kernel is required to use Kernel Clean\n"
-         exit 1
+        echo -e "\n${CROSS} ${RD}ERROR:${CL} Proxmox ${BL}${current_kernel}${CL} Kernel Active"
+        echo -e "\nAn Active PVE Kernel is required to use Kernel Clean\n"
+        exit 1
     fi
 }
 
 function kernel_info() {
- if [[ "$MODE" != "PBS" ]]; then
-     echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}" 
- fi
+    if [[ "$MODE" != "PBS" ]]; then
+        echo -e "${YW}PVE Version: ${BL}$(pveversion)\n${CL}"
+    fi
     if [[ "$current_kernel" == *"pve"* ]]; then
         echo -e "${YW}Current Kernel: ${BL}$current_kernel\n${CL}"
     else
@@ -80,50 +80,49 @@ function kernel_info() {
 }
 
 function kernel_clean() {
-    kernels=$(dpkg --list| grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
+    kernels=$(dpkg --list | grep 'kernel-.*-pve' | awk '{print $2}' | sort -V)
     remove_kernels=""
-    for kernel in $kernels
-      do
+    for kernel in $kernels; do
         if [ "$(echo $kernel | grep $current_kernel)" ]; then
             break
         else
             echo -e "${BL}'$kernel' ${CL}${YW}has been added to the remove Kernel list\n${CL}"
-                    remove_kernels+=" $kernel"
+            remove_kernels+=" $kernel"
         fi
     done
-msg_ok "Kernel Search Completed\n"
+    msg_ok "Kernel Search Completed\n"
     if [[ "$remove_kernels" != *"pve"* ]]; then
         echo -e "${PARTY}  ${GN}It appears there are no old Kernels on your system. \n${CL}"
         msg_info "Exiting"
         sleep 2
         msg_ok "Done"
     else
-    read -p "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') selected Kernels listed above? [y/n]: " -n 1 -r
+        read -p "Would you like to remove the $(echo $remove_kernels | awk '{print NF}') selected Kernels listed above? [y/n]: " -n 1 -r
         echo
-      if [[ $REPLY =~ ^[Yy]$ ]]; then
-        msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
-        /usr/bin/apt purge -y $remove_kernels > /dev/null 2>&1
-        msg_ok "Successfully Removed Kernels"
-        msg_info "Updating GRUB"
-        /usr/sbin/update-grub > /dev/null 2>&1
-        msg_ok "Successfully Updated GRUB"
-        msg_info "Exiting"
-        sleep 2
-        msg_ok "Done"
-      else
-        msg_info "Exiting"
-        sleep 2
-        msg_ok "Done"
-      fi
+        if [[ $REPLY =~ ^[Yy]$ ]]; then
+            msg_info "Removing ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${YW}old Kernels${CL}"
+            /usr/bin/apt purge -y $remove_kernels >/dev/null 2>&1
+            msg_ok "Successfully Removed Kernels"
+            msg_info "Updating GRUB"
+            /usr/sbin/update-grub >/dev/null 2>&1
+            msg_ok "Successfully Updated GRUB"
+            msg_info "Exiting"
+            sleep 2
+            msg_ok "Done"
+        else
+            msg_info "Exiting"
+            sleep 2
+            msg_ok "Done"
+        fi
     fi
 }
 
 if ! command -v pveversion >/dev/null 2>&1; then
-  echo -e " Switching to PBS mode"
-  MODE="PBS"
-  sleep 2
-  else
-  MODE="PVE"
+    echo -e " Switching to PBS mode"
+    MODE="PBS"
+    sleep 2
+else
+    MODE="PVE"
 fi
 
 check_root

+ 11 - 11
misc/latest-update-menu.sh

@@ -3,9 +3,9 @@
 while true; do
     read -p "This will create a New Update Menu for Home Assistant Container LXC. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
@@ -13,19 +13,19 @@ set -o errexit
 rm -rf /root/update.sh update update-containers.sh
 echo -e "\e[1;92m Creating New Update Menu Script... \e[0m"
 if [ -f /usr/local/lib/python3.9/dist-packages/runlike/runlike.py ]; then
-echo -e "\e[1;92m pip3/runlike Already Installed! \e[0m"
+    echo -e "\e[1;92m pip3/runlike Already Installed! \e[0m"
 else
-apt-get update &>/dev/null
-echo -e "\e[1;92m Installing pip3... \e[0m"
-apt-get install -y python3-pip &>/dev/null
-echo -e "\e[1;92m Installing runlike... \e[0m"
-pip3 install runlike &>/dev/null 
+    apt-get update &>/dev/null
+    echo -e "\e[1;92m Installing pip3... \e[0m"
+    apt-get install -y python3-pip &>/dev/null
+    echo -e "\e[1;92m Installing runlike... \e[0m"
+    pip3 install runlike &>/dev/null
 fi
 echo -e "\e[1;92m Creating Update Script... \e[0m"
 if [ -d /root/hass_config ]; then
-echo -e "\e[1;92m There's Already (hass_config) Folder! \e[0m"
+    echo -e "\e[1;92m There's Already (hass_config) Folder! \e[0m"
 else
-mkdir /root/hass_config
+    mkdir /root/hass_config
 fi
 UPDATE_PATH='/root/update'
 UPDATE_CONTAINERS_PATH='/root/update-containers.sh'

+ 11 - 11
misc/navidrome-update.sh

@@ -1,15 +1,15 @@
 #!/usr/bin/env bash
-RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 3, length($2)-4) }')
+RELEASE=$(curl -s https://api.github.com/repos/navidrome/navidrome/releases/latest |
+    grep "tag_name" |
+    awk '{print substr($2, 3, length($2)-4) }')
 
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 function update_info {
-cat << "EOF"
+    cat <<"EOF"
     _   __            _     __                        
    / | / /___ __   __(_)___/ /________  ____ ___  ___ 
   /  |/ / __  / | / / / __  / ___/ __ \/ __  __ \/ _ \
@@ -23,9 +23,9 @@ update_info
 while true; do
     read -p "This will Update Navidrome to v$RELEASE. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 sleep 2

+ 23 - 24
misc/nocodb-update.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -19,25 +19,25 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
 
 function error_exit() {
-  trap - ERR
-  local reason="Unknown failure occured."
-  local msg="${1:-$reason}"
-  local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
-  echo -e "$flag $msg" 1>&2
-  exit $EXIT
+    trap - ERR
+    local reason="Unknown failure occured."
+    local msg="${1:-$reason}"
+    local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
+    echo -e "$flag $msg" 1>&2
+    exit $EXIT
 }
 
 while true; do
     read -p "This will Update ${APP}. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${YW}
+    echo -e "${YW}
   _   _                 _____  ____  
  | \ | |               |  __ \|  _ \ 
  |  \| | ___ v3___ ___ | |  | | |_) |
@@ -68,18 +68,17 @@ msg_ok "Updated ${APP}"
 
 read -p "${APP} LXC needs to reboot to apply the update. Reboot now? " -n 1 -r
 echo
-if [[ $REPLY =~ ^[Yy]$ ]]
-then
+if [[ $REPLY =~ ^[Yy]$ ]]; then
     reboot=yes
 else
     reboot=no
 fi
 
-if [ "$reboot" == "yes" ]; then 
-msg_info "Rebooting ${APP} LXC"
-reboot
+if [ "$reboot" == "yes" ]; then
+    msg_info "Rebooting ${APP} LXC"
+    reboot
 fi
 
-if [ "$reboot" == "no" ]; then 
-msg_ok "Finished Updating ${APP}. Reboot to apply the update."
+if [ "$reboot" == "no" ]; then
+    msg_ok "Finished Updating ${APP}. Reboot to apply the update."
 fi

+ 73 - 64
misc/node-red-themes.sh

@@ -1,24 +1,24 @@
 #!/usr/bin/env bash
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/node-red-themes.sh)"
 set -o errexit
-show_menu(){
-    YW=`echo "\033[33m"`
-    RD=`echo "\033[01;31m"`
-    BL=`echo "\033[36m"`
+show_menu() {
+    YW=$(echo "\033[33m")
+    RD=$(echo "\033[01;31m")
+    BL=$(echo "\033[36m")
     CM='\xE2\x9C\x94\033'
-    GN=`echo "\033[1;92m"`
-    CL=`echo "\033[m"`
-echo -e "${RD} Backup your Node-Red flows before running this script!!${CL} \n "
-while true; do
-    read -p "This will Install Node-Red Themes. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
-done
-clear
-echo -e "${RD} Backup your Node-Red flows before installing any theme!!${CL} \n "
+    GN=$(echo "\033[1;92m")
+    CL=$(echo "\033[m")
+    echo -e "${RD} Backup your Node-Red flows before running this script!!${CL} \n "
+    while true; do
+        read -p "This will Install Node-Red Themes. Proceed(y/n)?" yn
+        case $yn in
+        [Yy]*) break ;;
+        [Nn]*) exit ;;
+        *) echo "Please answer yes or no." ;;
+        esac
+    done
+    clear
+    echo -e "${RD} Backup your Node-Red flows before installing any theme!!${CL} \n "
     printf "\n${BL}*********************************************${CL}\n"
     printf "${BL}**${YW} 1)${GN} Default Theme ${CL}\n"
     printf "${BL}**${YW} 2)${GN} Dark Theme ${CL}\n"
@@ -32,75 +32,84 @@ echo -e "${RD} Backup your Node-Red flows before installing any theme!!${CL} \n
     read opt
 }
 
-option_picked(){
-    msgcolor=`echo "\033[01;31m"`
-    normal=`echo "\033[00;00m"`
+option_picked() {
+    msgcolor=$(echo "\033[01;31m")
+    normal=$(echo "\033[00;00m")
     message=${@:-"${CL}Error: No message passed"}
     printf "${RD}${message}${CL}\n"
 }
 
 clear
 show_menu
-while [ "$opt" != " " ]
-    do
-      case $opt in
-        1) clear;
-            option_picked "Installing Default Theme";
-            THEME=
-            JS=//
-            break;
+while [ "$opt" != " " ]; do
+    case $opt in
+    1)
+        clear
+        option_picked "Installing Default Theme"
+        THEME=
+        JS=//
+        break
         ;;
-        2) clear;
-            option_picked "Installing Dark Theme";
-            THEME=dark
-            break;
+    2)
+        clear
+        option_picked "Installing Dark Theme"
+        THEME=dark
+        break
         ;;
-        3) clear;
-            option_picked "Installing Dracula Theme";
-            THEME=dracula
-            break;
+    3)
+        clear
+        option_picked "Installing Dracula Theme"
+        THEME=dracula
+        break
         ;;
-        4) clear;
-            option_picked "Installing Midnight-Red Theme";
-            THEME=midnight-red
-            break;
+    4)
+        clear
+        option_picked "Installing Midnight-Red Theme"
+        THEME=midnight-red
+        break
         ;;
-        5) clear;
-            option_picked "Installing Oled Theme";
-            THEME=oled
-            break;
+    5)
+        clear
+        option_picked "Installing Oled Theme"
+        THEME=oled
+        break
         ;;
-        6) clear;
-            option_picked "Installing Solarized-Dark Theme";
-            THEME=solarized-dark
-            break;
+    6)
+        clear
+        option_picked "Installing Solarized-Dark Theme"
+        THEME=solarized-dark
+        break
         ;;
-        7) clear;
-            option_picked "Installing Solarized-Light Theme";
-            THEME=solarized-light
-            break;
+    7)
+        clear
+        option_picked "Installing Solarized-Light Theme"
+        THEME=solarized-light
+        break
         ;;
 
-        x)exit;
+    x)
+        exit
         ;;
-        \n)exit;
+    \n)
+        exit
         ;;
-        *)clear;
-            option_picked "Please choose a theme from the menu";
-            show_menu;
+    *)
+        clear
+        option_picked "Please choose a theme from the menu"
+        show_menu
         ;;
-      esac
-  done
+    esac
+done
 echo -en "${GN} Installing ${THEME} Theme... "
 cd /root/.node-red
 if [ "${THEME}" = "" ]; then
-  echo -e "${CM}${CL} \r"
-  else
-npm install @node-red-contrib-themes/${THEME} &>/dev/null
-echo -e "${CM}${CL} \r"
+    echo -e "${CM}${CL} \r"
+else
+    npm install @node-red-contrib-themes/${THEME} &>/dev/null
+    echo -e "${CM}${CL} \r"
 fi
 echo -en "${GN} Writing Settings... "
-cat <<EOF > /root/.node-red/settings.js
+cat <<EOF >/root/.node-red/settings.js
 module.exports = { uiPort: process.env.PORT || 1880,
     mqttReconnectTime: 15000,
     serialReconnectTime: 15000,

+ 49 - 49
misc/npm_update.sh

@@ -1,16 +1,16 @@
 #!/usr/bin/env bash
-RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 3, length($2)-4) }') \
+RELEASE=$(curl -s https://api.github.com/repos/NginxProxyManager/nginx-proxy-manager/releases/latest |
+  grep "tag_name" |
+  awk '{print substr($2, 3, length($2)-4) }')
 
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 
 function update_info {
-echo -e "${RD}
+  echo -e "${RD}
   _   _   _____    __  __ 
  | \ | | |  __ \  |  \/  |
  |  \| | | |__) | | \  / |
@@ -24,19 +24,19 @@ ${CL}"
 update_info
 
 while true; do
-    read -p "This will update Nginx Proxy Manager to v${RELEASE}. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "This will update Nginx Proxy Manager to v${RELEASE}. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 clear
 update_info
-set -o errexit  
-set -o errtrace 
-set -o nounset  
-set -o pipefail 
+set -o errexit
+set -o errtrace
+set -o nounset
+set -o pipefail
 shopt -s expand_aliases
 alias die='EXIT=$? LINE=$LINENO error_exit'
 trap die ERR
@@ -57,23 +57,23 @@ function msg() {
 T="$(date +%M)"
 
 if [ -f /lib/systemd/system/npm.service ]; then
-echo -en "${GN} Prep For Update... "
-sleep 2
-echo -e "${CM}${CL} \r"
-echo -en "${GN} Stopping Services... "
+  echo -en "${GN} Prep For Update... "
+  sleep 2
+  echo -e "${CM}${CL} \r"
+  echo -en "${GN} Stopping Services... "
   systemctl stop openresty
   systemctl stop npm
-echo -e "${CM}${CL} \r"  
- 
-echo -en "${GN} Cleaning Old Files... "
+  echo -e "${CM}${CL} \r"
+
+  echo -en "${GN} Cleaning Old Files... "
   rm -rf /app \
-  /var/www/html \
-  /etc/nginx \
-  /var/log/nginx \
-  /var/lib/nginx \
-  /var/cache/nginx &>/dev/null
+    /var/www/html \
+    /etc/nginx \
+    /var/log/nginx \
+    /var/lib/nginx \
+    /var/cache/nginx &>/dev/null
   echo -e "${CM}${CL} \r"
-  else
+else
   echo -en "${RD} No NPM to Update! ${CL}"
   exit
 fi
@@ -103,24 +103,24 @@ cp docker/rootfs/etc/logrotate.d/nginx-proxy-manager /etc/logrotate.d/nginx-prox
 ln -sf /etc/nginx/nginx.conf /etc/nginx/conf/nginx.conf
 rm -f /etc/nginx/conf.d/dev.conf
 mkdir -p /tmp/nginx/body \
-/run/nginx \
-/data/nginx \
-/data/custom_ssl \
-/data/logs \
-/data/access \
-/data/nginx/default_host \
-/data/nginx/default_www \
-/data/nginx/proxy_host \
-/data/nginx/redirection_host \
-/data/nginx/stream \
-/data/nginx/dead_host \
-/data/nginx/temp \
-/var/lib/nginx/cache/public \
-/var/lib/nginx/cache/private \
-/var/cache/nginx/proxy_temp
+  /run/nginx \
+  /data/nginx \
+  /data/custom_ssl \
+  /data/logs \
+  /data/access \
+  /data/nginx/default_host \
+  /data/nginx/default_www \
+  /data/nginx/proxy_host \
+  /data/nginx/redirection_host \
+  /data/nginx/stream \
+  /data/nginx/dead_host \
+  /data/nginx/temp \
+  /var/lib/nginx/cache/public \
+  /var/lib/nginx/cache/private \
+  /var/cache/nginx/proxy_temp
 chmod -R 777 /var/cache/nginx
 chown root /tmp/nginx
-echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" > /etc/nginx/conf.d/include/resolvers.conf
+echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" {print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf);" >/etc/nginx/conf.d/include/resolvers.conf
 echo -e "${CM}${CL} \r"
 
 if [ ! -f /data/nginx/dummycert.pem ] || [ ! -f /data/nginx/dummykey.pem ]; then
@@ -144,7 +144,7 @@ echo -e "${CM}${CL} \r"
 echo -en "${GN} Initializing Backend... "
 rm -rf /app/config/default.json &>/dev/null
 if [ ! -f /app/config/production.json ]; then
-cat << 'EOF' > /app/config/production.json
+  cat <<'EOF' >/app/config/production.json
 {
   "database": {
     "engine": "knex-native",
@@ -168,7 +168,7 @@ systemctl enable npm &>/dev/null
 systemctl start openresty
 systemctl start npm
 echo -e "${CM}${CL} \r"
-TS="$(($(date +%M)-T))"
+TS="$(($(date +%M) - T))"
 
 IP=$(hostname -I | cut -f1 -d ' ')
 echo -e "${GN}Successfully Updated Nginx Proxy Manager to ${RD}${RELEASE}${CL} and it took ${RD}${TS} minutes.${CL}

+ 9 - 9
misc/paperless-ngx-update.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
 clear
 RELEASE=$(curl -s https://api.github.com/repos/paperless-ngx/paperless-ngx/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
-YW=`echo "\033[33m"`
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 RETRY_NUM=10
 RETRY_EVERY=3
 NUM=$RETRY_NUM
@@ -30,7 +30,7 @@ function msg_error() {
     echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 }
 
-cat << "EOF"
+cat <<"EOF"
     ____                        __                                     
    / __ \____ _____  ___  _____/ /__  __________    ____  ____ __  __
   / /_/ / __ `/ __ \/ _ \/ ___/ / _ \/ ___/ ___/___/ __ \/ __ `/ |/_/
@@ -42,9 +42,9 @@ EOF
 while true; do
     read -p "This will Update Paperless-ngx to $RELEASE. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 sleep 2

+ 39 - 37
misc/photoprism-update.sh

@@ -1,28 +1,28 @@
 #!/usr/bin/env bash
 set -e
-RELEASE=$(curl -s https://api.github.com/repos/photoprism/photoprism/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 2, length($2)-4) }') \
+RELEASE=$(curl -s https://api.github.com/repos/photoprism/photoprism/releases/latest |
+    grep "tag_name" |
+    awk '{print substr($2, 2, length($2)-4) }')
 
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
-PP=`echo "\e[1;35m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
+PP=$(echo "\e[1;35m")
 
 while true; do
     read -p "Update PhotoPrism LXC. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${PP}
+    echo -e "${PP}
   _____  _           _        _____      _               
  |  __ \| |         | |      |  __ \    (_)              
  | |__) | |__   ___ | |_ ___ | |__) | __ _ ___ _ __ ___  
@@ -34,7 +34,7 @@ ${CL}"
 }
 
 header_info
-show_menu(){
+show_menu() {
     printf "    ${YW} 1)${GN} Release Branch ${CL}\n"
     printf "    ${YW} 2)${YW} Develop Branch ${CL}\n"
 
@@ -42,37 +42,41 @@ show_menu(){
     read opt
 }
 
-option_picked(){
+option_picked() {
     message1=${@:-"${CL}Error: No message passed"}
     printf " ${YW}${message1}${CL}\n"
 }
 show_menu
-while [ "$opt" != " " ]
-    do
-      case $opt in
-        1) clear;
-            header_info;
-            option_picked "Using Release Branch";
-            BR="release"
-            break;
+while [ "$opt" != " " ]; do
+    case $opt in
+    1)
+        clear
+        header_info
+        option_picked "Using Release Branch"
+        BR="release"
+        break
         ;;
-        2) clear;
-            header_info;
-            option_picked "Using Develop Branch";
-            BR="develop"
-            break;
+    2)
+        clear
+        header_info
+        option_picked "Using Develop Branch"
+        BR="develop"
+        break
         ;;
 
-        x)exit;
+    x)
+        exit
         ;;
-        \n)exit;
+    \n)
+        exit
         ;;
-        *)clear;
-            option_picked "Please choose a Install Branch from the menu";
-            show_menu;
+    *)
+        clear
+        option_picked "Please choose a Install Branch from the menu"
+        show_menu
         ;;
-      esac
-  done
+    esac
+done
 
 echo -en "${GN} Stopping PhotoPrism... "
 sudo systemctl stop photoprism
@@ -100,5 +104,3 @@ sudo systemctl start photoprism
 echo -e "${CM}${CL} \n"
 
 echo -e "${GN} Finished ${CL} \n "
-
-

+ 22 - 22
misc/pms-copy-data.sh

@@ -3,12 +3,12 @@
 # run from the Proxmox Shell
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/pms-copy-data.sh)"
 while true; do
-    read -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from one Plex Media Server LXC to another. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -58,28 +58,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich Plex Media Server LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich Plex Media Server LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich Plex Media Server LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich Plex Media Server LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.01.24" 13 50 || exit
 info "Plex Media Server Data from '$CTID_FROM' to '$CTID_TO'"
@@ -89,13 +89,13 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then
 fi
 msg "Mounting Container Disks..."
 DATA_PATH=/var/lib/plexmediaserver/Library/
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] ||
   die "Plex Media Server directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${DATA_PATH}" ] ||
   die "Plex Media Server directories in '$CTID_TO' not found."
 
 #rm -rf ${CTID_TO_PATH}${DATA_PATH}

+ 22 - 22
misc/podman-copy-data-docker.sh

@@ -3,12 +3,12 @@
 # run from the Proxmox Shell
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/podman-copy-data-docker.sh)"
 while true; do
-    read -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from a Podman Home Assistant LXC to a Docker Home Assistant LXC. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -58,28 +58,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA Podman LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA Podman LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich HA LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich HA LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.03.31" 13 50 || exit
 info "Home Assistant Data from '$CTID_FROM' to '$CTID_TO'"
@@ -90,13 +90,13 @@ fi
 msg "Mounting Container Disks..."
 DOCKER_PATH=/var/lib/docker/volumes/hass_config/
 PODMAN_PATH=/var/lib/containers/storage/volumes/hass_config/
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${PODMAN_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${PODMAN_PATH}" ] ||
   die "Home Assistant directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${DOCKER_PATH}" ] ||
   die "Home Assistant directories in '$CTID_TO' not found."
 
 rm -rf ${CTID_TO_PATH}${DOCKER_PATH}

+ 3 - 3
misc/podman_hacs.sh

@@ -4,9 +4,9 @@ echo -e "\e[1;33m This script will install Home Assistant Community Store (HACS)
 while true; do
     read -p "Start the HACS Install Script (y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 

+ 48 - 55
misc/post-pbs-install.sh

@@ -1,13 +1,13 @@
 #!/usr/bin/env bash -ex
 set -euo pipefail
 shopt -s inherit_errexit nullglob
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -17,19 +17,19 @@ echo -e "${BL}This script will Perform Post Install Routines.${CL}"
 while true; do
     read -p "Start the PBS Post Install Script (y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 
 if command -v pveversion >/dev/null 2>&1; then
-  echo -e "\n🛑  PVE Detected, Wrong Script!\n"
-  exit 1
+    echo -e "\n🛑  PVE Detected, Wrong Script!\n"
+    exit 1
 fi
 
 function header_info {
-cat << "EOF"
+    cat <<"EOF"
     ____  ____ _____    ____             __     ____           __        ____
    / __ \/ __ ) ___/   / __ \____  _____/ /_   /  _/___  _____/ /_____ _/ / /
   / /_/ / __  \__ \   / /_/ / __ \/ ___/ __/   / // __ \/ ___/ __/ __ `/ / / 
@@ -52,74 +52,67 @@ function msg_ok() {
 clear
 header_info
 read -r -p "Disable Enterprise Repository? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Disabling Enterprise Repository"
-sleep 2
-sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pbs-enterprise.list
-msg_ok "Disabled Enterprise Repository"
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Disabling Enterprise Repository"
+    sleep 2
+    sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pbs-enterprise.list
+    msg_ok "Disabled Enterprise Repository"
 fi
 
 read -r -p "Add/Correct PBS Sources (sources.list)? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Adding or Correcting PBS Sources"
-cat <<EOF > /etc/apt/sources.list
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Adding or Correcting PBS Sources"
+    cat <<EOF >/etc/apt/sources.list
 deb http://ftp.debian.org/debian bullseye main contrib
 deb http://ftp.debian.org/debian bullseye-updates main contrib
 deb http://security.debian.org/debian-security bullseye-security main contrib
 EOF
-sleep 2
-msg_ok "Added or Corrected PBS Sources"
+    sleep 2
+    msg_ok "Added or Corrected PBS Sources"
 fi
 
 read -r -p "Enable No-Subscription Repository? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Enabling No-Subscription Repository"
-cat <<EOF >> /etc/apt/sources.list
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Enabling No-Subscription Repository"
+    cat <<EOF >>/etc/apt/sources.list
 deb http://download.proxmox.com/debian/pbs bullseye pbs-no-subscription
 EOF
-sleep 2
-msg_ok "Enabled No-Subscription Repository"
+    sleep 2
+    msg_ok "Enabled No-Subscription Repository"
 fi
 
 read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Adding Beta/Test Repository and set disabled"
-cat <<EOF >> /etc/apt/sources.list
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Adding Beta/Test Repository and set disabled"
+    cat <<EOF >>/etc/apt/sources.list
 # deb http://download.proxmox.com/debian/pbs bullseye pbstest
 EOF
-sleep 2
-msg_ok "Added Beta/Test Repository"
+    sleep 2
+    msg_ok "Added Beta/Test Repository"
 fi
 
 read -r -p "Disable Subscription Nag? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Disabling Subscription Nag"
-echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script
-apt --reinstall install proxmox-widget-toolkit &>/dev/null
-msg_ok "Disabled Subscription Nag"
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Disabling Subscription Nag"
+    echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script
+    apt --reinstall install proxmox-widget-toolkit &>/dev/null
+    msg_ok "Disabled Subscription Nag"
 fi
 
 read -r -p "Update Proxmox Backup Server now? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Updating Proxmox Backup Server (Patience)"
-apt-get update &>/dev/null
-apt-get -y dist-upgrade &>/dev/null
-msg_ok "Updated Proxmox Backup Server (⚠ Reboot Recommended)"
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Updating Proxmox Backup Server (Patience)"
+    apt-get update &>/dev/null
+    apt-get -y dist-upgrade &>/dev/null
+    msg_ok "Updated Proxmox Backup Server (⚠ Reboot Recommended)"
 fi
 
 read -r -p "Reboot Proxmox Backup Server now? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Rebooting Proxmox Backup Server"
-sleep 2
-msg_ok "Completed Post Install Routines"
-reboot
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Rebooting Proxmox Backup Server"
+    sleep 2
+    msg_ok "Completed Post Install Routines"
+    reboot
 fi
 
 sleep 2

+ 54 - 61
misc/post-pve-install.sh

@@ -1,13 +1,13 @@
 #!/usr/bin/env bash -ex
 set -euo pipefail
 shopt -s inherit_errexit nullglob
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -17,26 +17,26 @@ echo -e "${BL}This script will Perform Post Install Routines.${CL}"
 while true; do
     read -p "Start the PVE7 Post Install Script (y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 
 if ! command -v pveversion >/dev/null 2>&1; then
-  echo -e "\n🛑  No PVE Detected, Wrong Script!\n"
-  exit 1
+    echo -e "\n🛑  No PVE Detected, Wrong Script!\n"
+    exit 1
 fi
 
-if [ `pveversion | grep "pve-manager/7" | wc -l` -ne 1 ]; then
-        echo -e "\n${RD}⚠ This version of Proxmox Virtual Environment is not supported"
-        echo -e "Requires PVE Version: 7.XX${CL}"
-        echo -e "\nExiting..."
-        sleep 3
-        exit
+if [ $(pveversion | grep "pve-manager/7" | wc -l) -ne 1 ]; then
+    echo -e "\n${RD}⚠ This version of Proxmox Virtual Environment is not supported"
+    echo -e "Requires PVE Version: 7.XX${CL}"
+    echo -e "\nExiting..."
+    sleep 3
+    exit
 fi
 function header_info {
-echo -e "${RD}
+    echo -e "${RD}
     ____ _    _____________   ____             __     ____           __        ____
    / __ \ |  / / ____/__  /  / __ \____  _____/ /_   /  _/___  _____/ /_____ _/ / /
   / /_/ / | / / __/    / /  / /_/ / __ \/ ___/ __/   / // __ \/ ___/ __/ __  / / / 
@@ -58,74 +58,67 @@ function msg_ok() {
 clear
 header_info
 read -r -p "Disable Enterprise Repository? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Disabling Enterprise Repository"
-sleep 2
-sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pve-enterprise.list
-msg_ok "Disabled Enterprise Repository"
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Disabling Enterprise Repository"
+    sleep 2
+    sed -i "s/^deb/#deb/g" /etc/apt/sources.list.d/pve-enterprise.list
+    msg_ok "Disabled Enterprise Repository"
 fi
 
 read -r -p "Add/Correct PVE7 Sources (sources.list)? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Adding or Correcting PVE7 Sources"
-cat <<EOF > /etc/apt/sources.list
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Adding or Correcting PVE7 Sources"
+    cat <<EOF >/etc/apt/sources.list
 deb http://ftp.debian.org/debian bullseye main contrib
 deb http://ftp.debian.org/debian bullseye-updates main contrib
 deb http://security.debian.org/debian-security bullseye-security main contrib
 EOF
-sleep 2
-msg_ok "Added or Corrected PVE7 Sources"
+    sleep 2
+    msg_ok "Added or Corrected PVE7 Sources"
 fi
 
 read -r -p "Enable No-Subscription Repository? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Enabling No-Subscription Repository"
-cat <<EOF >> /etc/apt/sources.list
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Enabling No-Subscription Repository"
+    cat <<EOF >>/etc/apt/sources.list
 deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
 EOF
-sleep 2
-msg_ok "Enabled No-Subscription Repository"
+    sleep 2
+    msg_ok "Enabled No-Subscription Repository"
 fi
 
 read -r -p "Add (Disabled) Beta/Test Repository? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Adding Beta/Test Repository and set disabled"
-cat <<EOF >> /etc/apt/sources.list
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Adding Beta/Test Repository and set disabled"
+    cat <<EOF >>/etc/apt/sources.list
 # deb http://download.proxmox.com/debian/pve bullseye pvetest
 EOF
-sleep 2
-msg_ok "Added Beta/Test Repository"
+    sleep 2
+    msg_ok "Added Beta/Test Repository"
 fi
 
 read -r -p "Disable Subscription Nag? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Disabling Subscription Nag"
-echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" > /etc/apt/apt.conf.d/no-nag-script
-apt --reinstall install proxmox-widget-toolkit &>/dev/null
-msg_ok "Disabled Subscription Nag (Delete browser cache)"
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Disabling Subscription Nag"
+    echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/Active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script
+    apt --reinstall install proxmox-widget-toolkit &>/dev/null
+    msg_ok "Disabled Subscription Nag (Delete browser cache)"
 fi
 
 read -r -p "Update Proxmox VE 7 now? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Updating Proxmox VE 7 (Patience)"
-apt-get update &>/dev/null
-apt-get -y dist-upgrade &>/dev/null
-msg_ok "Updated Proxmox VE 7 (⚠ Reboot Recommended)"
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Updating Proxmox VE 7 (Patience)"
+    apt-get update &>/dev/null
+    apt-get -y dist-upgrade &>/dev/null
+    msg_ok "Updated Proxmox VE 7 (⚠ Reboot Recommended)"
 fi
 
 read -r -p "Reboot Proxmox VE 7 now? <y/N> " prompt
-if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
-then
-msg_info "Rebooting Proxmox VE 7"
-sleep 2
-msg_ok "Completed Post Install Routines"
-reboot
+if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
+    msg_info "Rebooting Proxmox VE 7"
+    sleep 2
+    msg_ok "Completed Post Install Routines"
+    reboot
 fi
 
 sleep 2

+ 46 - 38
misc/scaling-governor.sh

@@ -4,14 +4,14 @@ set -e
 while true; do
     read -p "View CPU Scaling Governors. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "
+    echo -e "
    _____ _____  _    _ 
   / ____|  __ \| |  | |
  | |    | |__) | |  | |
@@ -21,16 +21,16 @@ echo -e "
     Scaling Governors
 "
 }
-show_menu(){
-    CL=`echo "\033[m"`
-    GN=`echo "\033[32m"`
-    BL=`echo "\033[36m"`
-    YW=`echo "\033[33m"`
-    fgred=`echo "\033[31m"`
-header_info
+show_menu() {
+    CL=$(echo "\033[m")
+    GN=$(echo "\033[32m")
+    BL=$(echo "\033[36m")
+    YW=$(echo "\033[33m")
+    fgred=$(echo "\033[31m")
+    header_info
     CK=$(uname -r)
     IP=$(hostname -I)
-#    MAC=$(cat /sys/class/net/eno1/address)
+    #    MAC=$(cat /sys/class/net/eno1/address)
     ACSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
     CCSG=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
     echo -e "${YW}Proxmox IP ${BL}${IP}${CL}"
@@ -41,7 +41,7 @@ header_info
 
     echo -e "\n${YW}Available CPU Scaling Governors
     ${BL}${ACSG}${CL}"
-    
+
     echo -e "\n${YW}Current CPU Scaling Governor
     ${BL}${CCSG}${CL}"
     printf "\n ${fgred}Only Select Available CPU Scaling Governors From Above${CL}\n \n"
@@ -57,43 +57,51 @@ header_info
 }
 clear
 show_menu
-while [ $opt != '' ]
-    do
+while [ $opt != '' ]; do
     if [ $opt = '' ]; then
-      exit;
+        exit
     else
-      case $opt in
-        1) echo "conservative" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+        case $opt in
+        1)
+            echo "conservative" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+            clear
+            show_menu
+            ;;
+        2)
+            echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
             clear
             show_menu
-        ;;
-        2) echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+            ;;
+        3)
+            echo "userspace" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
             clear
             show_menu
-        ;;
-        3) echo "userspace" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+            ;;
+        4)
+            echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
             clear
             show_menu
-        ;;
-        4) echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+            ;;
+        5)
+            echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
             clear
             show_menu
-        ;;
-        5) echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+            ;;
+        6)
+            echo "schedutil" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
             clear
             show_menu
-        ;;
-        6) echo "schedutil" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
+            ;;
+        x)
+            exit
+            ;;
+        \n)
+            exit
+            ;;
+        *)
             clear
             show_menu
-        ;;
-        x)exit;
-        ;;
-        \n)exit;
-        ;;
-        *)clear;
-            show_menu;
-        ;;
-      esac
+            ;;
+        esac
     fi
-  done
+done

+ 26 - 35
misc/technitiumdns-update.sh

@@ -7,61 +7,52 @@ dnsUrl="https://download.technitium.com/dns/DnsServerPortable.tar.gz"
 
 mkdir -p $dnsDir
 installLog="$dnsDir/install.log"
-echo "" > $installLog
+echo "" >$installLog
 
 echo ""
 echo "==============================="
 echo "Technitium DNS Server Update"
 echo "==============================="
 
-if dotnet --list-runtimes 2> /dev/null | grep -q "Microsoft.NETCore.App 6.0."; 
-then
+if dotnet --list-runtimes 2>/dev/null | grep -q "Microsoft.NETCore.App 6.0."; then
 	dotnetFound="yes"
 else
 	dotnetFound="no"
 fi
 
-	if [ -d $dotnetDir ]
-	then
-	    dotnetUpdate="yes"
-		echo "Updating .NET 6 Runtime..."
-	fi
+if [ -d $dotnetDir ]; then
+	dotnetUpdate="yes"
+	echo "Updating .NET 6 Runtime..."
+fi
 
-	curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -c 6.0 --runtime dotnet --no-path --install-dir $dotnetDir --verbose >> $installLog 2>&1
+curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -c 6.0 --runtime dotnet --no-path --install-dir $dotnetDir --verbose >>$installLog 2>&1
 
-	if [ ! -f "/usr/bin/dotnet" ]
-	then
-		ln -s $dotnetDir/dotnet /usr/bin >> $installLog 2>&1
-	fi
+if [ ! -f "/usr/bin/dotnet" ]; then
+	ln -s $dotnetDir/dotnet /usr/bin >>$installLog 2>&1
+fi
 
-	if dotnet --list-runtimes 2> /dev/null | grep -q "Microsoft.NETCore.App 6.0."; 
-	then
-		if [ "$dotnetUpdate" = "yes" ]
-		then
-			echo ".NET 6 Runtime was updated successfully!"
-		fi
-	else
-		echo "Failed to update .NET 6 Runtime. Please try again."
-		exit 1
+if dotnet --list-runtimes 2>/dev/null | grep -q "Microsoft.NETCore.App 6.0."; then
+	if [ "$dotnetUpdate" = "yes" ]; then
+		echo ".NET 6 Runtime was updated successfully!"
 	fi
+else
+	echo "Failed to update .NET 6 Runtime. Please try again."
+	exit 1
+fi
 
-if curl -o $dnsTar --fail $dnsUrl >> $installLog 2>&1
-then
-	if [ -d $dnsDir ]
-	then
+if curl -o $dnsTar --fail $dnsUrl >>$installLog 2>&1; then
+	if [ -d $dnsDir ]; then
 		echo "Updating Technitium DNS Server..."
 	fi
-	
-	tar -zxf $dnsTar -C $dnsDir >> $installLog 2>&1
-	
-	if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ] 
-	then
-		if [ -f "/etc/systemd/system/dns.service" ]
-		then
+
+	tar -zxf $dnsTar -C $dnsDir >>$installLog 2>&1
+
+	if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ]; then
+		if [ -f "/etc/systemd/system/dns.service" ]; then
 			echo "Restarting systemd service..."
-			systemctl restart dns.service >> $installLog 2>&1
+			systemctl restart dns.service >>$installLog 2>&1
 		fi
-	
+
 		echo ""
 		echo "Technitium DNS Server was updated successfully!"
 	else

+ 11 - 11
misc/trilium-update.sh

@@ -1,15 +1,15 @@
 #!/usr/bin/env bash
-RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 3, length($2)-4) }')
+RELEASE=$(curl -s https://api.github.com/repos/zadam/trilium/releases/latest |
+    grep "tag_name" |
+    awk '{print substr($2, 3, length($2)-4) }')
 
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 function update_info {
-cat << "EOF"
+    cat <<"EOF"
   ______     _ ___               
  /_  __/____(_) (_)_  ______ ___ 
   / / / ___/ / / / / / / __ `__ \
@@ -23,9 +23,9 @@ update_info
 while true; do
     read -p "This will Update Trilium to v$RELEASE. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 sleep 2

+ 9 - 10
misc/unifi-update.sh

@@ -1,22 +1,22 @@
 #!/usr/bin/env bash
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 APP="UniFi Update"
 while true; do
     read -p "This will run ${APP}. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${RD}
+    echo -e "${RD}
   _    _       _ ______ _ 
  | |  | |     (_)  ____(_)
  | |  | |_ __  _| |__   _ 
@@ -30,4 +30,3 @@ ${CL}"
 header_info
 sleep 3
 wget -qL https://get.glennr.nl/unifi/update/unifi-update.sh && bash unifi-update.sh
-

+ 35 - 36
misc/update-lxcs.sh

@@ -1,22 +1,22 @@
 #!/bin/bash
 set -e
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 while true; do
-    read -p "This Will Update All LXC Containers. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "This Will Update All LXC Containers. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 clear
 function header_info {
-echo -e "${BL}
+  echo -e "${BL}
   _    _ _____  _____       _______ ______ 
  | |  | |  __ \|  __ \   /\|__   __|  ____|
  | |  | | |__) | |  | | /  \  | |  | |__   
@@ -39,34 +39,33 @@ function update_container() {
 }
 read -p "Skip stopped containers? " -n 1 -r
 echo
-if [[ ! $REPLY =~ ^[Yy]$ ]]
-then
-    skip=no
+if [[ ! $REPLY =~ ^[Yy]$ ]]; then
+  skip=no
 else
-    skip=yes
+  skip=yes
 fi
 
-for container in $containers
-do
-  status=`pct status $container`
- if [ "$skip" == "no" ]; then 
-  if [ "$status" == "status: stopped" ]; then
-    echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
-    pct start $container
-    echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
-    sleep 5
-    update_container $container
-    echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
-    pct shutdown $container &
-  elif [ "$status" == "status: running" ]; then
-    update_container $container
+for container in $containers; do
+  status=$(pct status $container)
+  if [ "$skip" == "no" ]; then
+    if [ "$status" == "status: stopped" ]; then
+      echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL} \n"
+      pct start $container
+      echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL} \n"
+      sleep 5
+      update_container $container
+      echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL} \n"
+      pct shutdown $container &
+    elif [ "$status" == "status: running" ]; then
+      update_container $container
+    fi
   fi
- fi 
- if [ "$skip" == "yes" ]; then
-  if [ "$status" == "status: running" ]; then
-    update_container $container
+  if [ "$skip" == "yes" ]; then
+    if [ "$status" == "status: running" ]; then
+      update_container $container
+    fi
   fi
- fi 
-done; wait
+done
+wait
 
 echo -e "${GN} Finished, All Containers Updated. ${CL} \n"

+ 15 - 12
misc/uptimekuma-update.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash -ex
 LATEST=$(curl -sL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
-YW=`echo "\033[33m"`
-BL=`echo "\033[36m"`
-RD=`echo "\033[01;31m"`
-BGN=`echo "\033[4;92m"`
-GN=`echo "\033[1;92m"`
-DGN=`echo "\033[32m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+BL=$(echo "\033[36m")
+RD=$(echo "\033[01;31m")
+BGN=$(echo "\033[4;92m")
+GN=$(echo "\033[1;92m")
+DGN=$(echo "\033[32m")
+CL=$(echo "\033[m")
 BFR="\\r\\033[K"
 HOLD="-"
 CM="${GN}✓${CL}"
@@ -14,14 +14,14 @@ APP="Uptime Kuma"
 while true; do
     read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
 function header_info {
-echo -e "${DGN}
+    echo -e "${DGN}
   _    _       _   _                  _  __                     
  | |  | |     | | (_)                | |/ /                     
  | |  | |_v3_ | |_ _ _ __ ___   ___  | ' /_   _ _ __ ___   __ _ 
@@ -45,7 +45,10 @@ function msg_ok() {
     echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 
-if [ ! -d "/opt/uptime-kuma" ]; then echo -e "No Uptime Kuma Directory Found."; exit; fi
+if [ ! -d "/opt/uptime-kuma" ]; then
+    echo -e "No Uptime Kuma Directory Found."
+    exit
+fi
 
 msg_info "Stopping ${APP}"
 sudo systemctl stop uptime-kuma &>/dev/null

+ 8 - 8
misc/usb-passthrough.sh

@@ -1,12 +1,12 @@
 #!/usr/bin/env bash
 echo -e "\e[1;33m This script will allow USB passthrough to a PRIVILEGED LXC Container ONLY\e[0m"
 while true; do
-    read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Did you replace 106 with your LXC ID? Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 
 set -o errexit
@@ -45,7 +45,7 @@ for char_dev in ${CHAR_DEVS[@]}; do
   CHAR_DEV_STRING+=" -regex \".*/${char_dev}\""
 done
 
-read -r -d '' HOOK_SCRIPT <<- EOF || true
+read -r -d '' HOOK_SCRIPT <<-EOF || true
 for char_dev in \$(find /sys/dev/char -regextype sed $CHAR_DEV_STRING); do
   dev="/dev/\$(sed -n "/DEVNAME/ s/^.*=\(.*\)$/\1/p" \${char_dev}/uevent)";
   mkdir -p \$(dirname \${LXC_ROOTFS_MOUNT}\${dev});
@@ -63,7 +63,7 @@ CTID_CONFIG_PATH=/etc/pve/lxc/${CTID}.conf
 sed '/autodev/d' $CTID_CONFIG_PATH >CTID.conf
 cat CTID.conf >$CTID_CONFIG_PATH
 
-cat <<EOF >> $CTID_CONFIG_PATH
+cat <<EOF >>$CTID_CONFIG_PATH
 lxc.autodev: 1
 lxc.hook.autodev: bash -c '$HOOK_SCRIPT'
 EOF

+ 11 - 11
misc/vaultwarden-update.sh

@@ -1,15 +1,15 @@
 #!/usr/bin/env bash
-VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 2, length($2)-3) }')
+VAULT=$(curl -s https://api.github.com/repos/dani-garcia/vaultwarden/releases/latest |
+    grep "tag_name" |
+    awk '{print substr($2, 2, length($2)-3) }')
 
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 function update_info {
-echo -e "${BL}
+    echo -e "${BL}
  __      __         _ _                         _            
  \ \    / /        | | |                       | |           
   \ \  / /_ _ _   _| | |___      ____ _ _ __ __| | ___ _ __  
@@ -24,9 +24,9 @@ update_info
 while true; do
     read -p "This will Update Vaultwarden to $VAULT (set 2vCPU 2048MiB RAM Min.). Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 sleep 2

+ 14 - 14
misc/web-vault-update.sh

@@ -1,15 +1,15 @@
 #!/usr/bin/env bash
-VWRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest \
-| grep "tag_name" \
-| awk '{print substr($2, 2, length($2)-3) }')
+VWRELEASE=$(curl -s https://api.github.com/repos/dani-garcia/bw_web_builds/releases/latest |
+    grep "tag_name" |
+    awk '{print substr($2, 2, length($2)-3) }')
 
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 function update_info {
-echo -e "${BL}
+    echo -e "${BL}
  __          __  _                            _ _   
  \ \        / / | |                          | | |  
   \ \  /\  / /__| |__ ________   ____ _ _   _| | |_ 
@@ -23,9 +23,9 @@ update_info
 while true; do
     read -p "This will Update Web-Vault to $VWRELEASE. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 sleep 2
@@ -36,9 +36,9 @@ sleep 1
 echo -e "${GN} Updating to ${VWRELEASE}... ${CL}"
 curl -fsSLO https://github.com/dani-garcia/bw_web_builds/releases/download/$VWRELEASE/bw_web_$VWRELEASE.tar.gz &>/dev/null
 if [ -d "/var/lib/vaultwarden" ]; then
-tar -xzf bw_web_$VWRELEASE.tar.gz -C /var/lib/vaultwarden/ &>/dev/null
-else 
-tar -zxf bw_web_$VWRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null
+    tar -xzf bw_web_$VWRELEASE.tar.gz -C /var/lib/vaultwarden/ &>/dev/null
+else
+    tar -zxf bw_web_$VWRELEASE.tar.gz -C /opt/vaultwarden/ &>/dev/null
 fi
 
 echo -e "${GN} Cleaning up... ${CL}"

+ 9 - 10
misc/webmin.sh

@@ -1,17 +1,17 @@
 #!/usr/bin/env bash
 
-YW=`echo "\033[33m"`
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
+YW=$(echo "\033[33m")
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
 CM='\xE2\x9C\x94\033'
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 while true; do
     read -p "This will Install Webmin, Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
 clear
@@ -34,7 +34,6 @@ echo -en "${GN} Setting Default Webmin usermame & password to root... "
 rm -rf /root/webmin_2.000_all.deb
 echo -e "${CM}${CL} \r"
 IP=$(hostname -I | cut -f1 -d ' ')
-echo -e    "Successfully Installed!! Webmin should be reachable by going to https://${IP}:10000"
-
+echo -e "Successfully Installed!! Webmin should be reachable by going to https://${IP}:10000"
 
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/webmin.sh)"

+ 22 - 22
misc/z2m-copy-data.sh

@@ -3,12 +3,12 @@
 # run from the Proxmox Shell
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/z2m-copy-data.sh)"
 while true; do
-    read -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from one Zigbee2MQTT LXC to another. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 set -o errexit
 set -o errtrace
@@ -58,28 +58,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich Zigbee2MQTT LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich Zigbee2MQTT LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich Zigbee2MQTT LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich Zigbee2MQTT LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.01.23" 13 50 || exit
 info "Zigbee2MQTT Data from '$CTID_FROM' to '$CTID_TO'"
@@ -89,13 +89,13 @@ if [ $(pct status $CTID_TO | sed 's/.* //') == 'running' ]; then
 fi
 msg "Mounting Container Disks..."
 DATA_PATH=/opt/zigbee2mqtt/data/
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] ||
   die "Zigbee2igbee2MQTT directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${DATA_PATH}" ] || \
+[ -d "${CTID_TO_PATH}${DATA_PATH}" ] ||
   die "Zigbee2MQTT directories in '$CTID_TO' not found."
 
 #rm -rf ${CTID_TO_PATH}${DATA_PATH}

+ 22 - 23
misc/zwave-copy-data.sh

@@ -3,12 +3,12 @@
 # run from the Proxmox Shell
 # bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/zwave-copy-data.sh)"
 while true; do
-    read -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn
-    case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
-    esac
+  read -p "Use to copy all data from a Zwavejs2MQTT LXC to a Z-wave JS UI LXC. Proceed(y/n)?" yn
+  case $yn in
+  [Yy]*) break ;;
+  [Nn]*) exit ;;
+  *) echo "Please answer yes or no." ;;
+  esac
 done
 clear
 set -o errexit
@@ -59,28 +59,28 @@ while read -r line; do
   if [[ $((${#ITEM} + $OFFSET)) -gt ${MSG_MAX_LENGTH:-} ]]; then
     MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
   fi
-  CTID_MENU+=( "$TAG" "$ITEM " "OFF" )
+  CTID_MENU+=("$TAG" "$ITEM " "OFF")
 done < <(pct list | awk 'NR>1')
 while [ -z "${CTID_FROM:+x}" ]; do
   CTID_FROM=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich Zwavejs2MQTT LXC would you like to copy FROM?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich Zwavejs2MQTT LXC would you like to copy FROM?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 while [ -z "${CTID_TO:+x}" ]; do
   CTID_TO=$(whiptail --title "$TITLE" --radiolist \
-  "\nWhich Z-wave JS UI LXC would you like to copy TO?\n" \
-  16 $(($MSG_MAX_LENGTH + 23)) 6 \
-  "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
+    "\nWhich Z-wave JS UI LXC would you like to copy TO?\n" \
+    16 $(($MSG_MAX_LENGTH + 23)) 6 \
+    "${CTID_MENU[@]}" 3>&1 1>&2 2>&3) || exit
 done
 for i in ${!CTID_MENU[@]}; do
-  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] && \
-    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
-  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] && \
-    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i+1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_FROM" ] &&
+    CTID_FROM_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
+  [ "${CTID_MENU[$i]}" == "$CTID_TO" ] &&
+    CTID_TO_HOSTNAME=$(sed 's/[[:space:]]*$//' <<<${CTID_MENU[$i + 1]})
 done
 whiptail --defaultno --title "$TITLE" --yesno \
-"Are you sure you want to copy data between the following LXCs?
+  "Are you sure you want to copy data between the following LXCs?
 $CTID_FROM (${CTID_FROM_HOSTNAME}) -> $CTID_TO (${CTID_TO_HOSTNAME})
 Version: 2022.09.21" 13 50 || exit
 info "Zwavejs2MQTT Data from '$CTID_FROM' to '$CTID_TO'"
@@ -91,13 +91,13 @@ fi
 msg "Mounting Container Disks..."
 DATA_PATH=/opt/zwavejs2mqtt/store/
 DATA_PATH_NEW=/opt/zwave-js-ui/store/
-CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_FROM_PATH=$(pct mount $CTID_FROM | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_FROM}'."
-[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] || \
+[ -d "${CTID_FROM_PATH}${DATA_PATH}" ] ||
   die "Zwavejs2MQTT directories in '$CTID_FROM' not found."
-CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") || \
+CTID_TO_PATH=$(pct mount $CTID_TO | sed -n "s/.*'\(.*\)'/\1/p") ||
   die "There was a problem mounting the root disk of LXC '${CTID_TO}'."
-[ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] || \
+[ -d "${CTID_TO_PATH}${DATA_PATH_NEW}" ] ||
   die "Zwavejs2MQTT directories in '$CTID_TO' not found."
 
 #rm -rf ${CTID_TO_PATH}${DATA_PATH}
@@ -117,4 +117,3 @@ rsync ${RSYNC_OPTIONS[*]} ${CTID_FROM_PATH}${DATA_PATH} ${CTID_TO_PATH}${DATA_PA
 echo -en "\e[1A\e[0K\e[1A\e[0K"
 
 info "Successfully Transferred Data."
-

+ 15 - 12
misc/zwave-js-ui-update.sh

@@ -1,11 +1,11 @@
 #!/usr/bin/env bash
-RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') 
+RELEASE=$(curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
 set -e
-YW=`echo "\033[33m"`
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 CM="${GN}✓${CL}"
 CROSS="${RD}✗${CL}"
 BFR="\\r\\033[K"
@@ -25,7 +25,7 @@ function msg_error() {
     echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 }
 clear
-cat << "EOF"
+cat <<"EOF"
  _____                                  _______    __  ______
 /__  /_      ______ __   _____         / / ___/   / / / /  _/
   / /| | /| / / __ `/ | / / _ \   __  / /\__ \   / / / // /  
@@ -38,12 +38,15 @@ EOF
 while true; do
     read -p "This will update ZWave JS UI to $RELEASE. Proceed(y/n)?" yn
     case $yn in
-        [Yy]* ) break;;
-        [Nn]* ) exit;;
-        * ) echo "Please answer yes or no.";;
+    [Yy]*) break ;;
+    [Nn]*) exit ;;
+    *) echo "Please answer yes or no." ;;
     esac
 done
-if [ ! -d /opt/zwave-js-ui ]; then msg_error "No Zwave JS UI Install Detected!"; exit; fi
+if [ ! -d /opt/zwave-js-ui ]; then
+    msg_error "No Zwave JS UI Install Detected!"
+    exit
+fi
 
 msg_info "Stopping Z-wave JS UI"
 systemctl stop zwave-js-ui.service
@@ -56,7 +59,7 @@ unzip zwave-js-ui-${RELEASE}-linux.zip &>/dev/null
 msg_ok "Updated Z-wave JS UI"
 
 msg_info "Updating Z-wave JS UI service file"
-cat << EOF > /etc/systemd/system/zwave-js-ui.service
+cat <<EOF >/etc/systemd/system/zwave-js-ui.service
 [Unit]
 Description=zwave-js-ui
 Wants=network-online.target

+ 33 - 31
setup/adguard-install.sh

@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
-YW=`echo "\033[33m"`
-RD=`echo "\033[01;31m"`
-BL=`echo "\033[36m"`
-GN=`echo "\033[1;92m"`
-CL=`echo "\033[m"`
+YW=$(echo "\033[33m")
+RD=$(echo "\033[01;31m")
+BL=$(echo "\033[36m")
+GN=$(echo "\033[1;92m")
+CL=$(echo "\033[m")
 RETRY_NUM=10
 RETRY_EVERY=3
 NUM=$RETRY_NUM
@@ -29,30 +29,29 @@ function error_exit() {
 }
 
 function msg_info() {
-    local msg="$1"
-    echo -ne " ${HOLD} ${YW}${msg}..."
+  local msg="$1"
+  echo -ne " ${HOLD} ${YW}${msg}..."
 }
 
 function msg_ok() {
-    local msg="$1"
-    echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
 }
 
 function msg_error() {
-    local msg="$1"
-    echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
+  local msg="$1"
+  echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
 }
 
 msg_info "Setting up Container OS "
 sed -i "/$LANG/ s/\(^# \)//" /etc/locale.gen
 locale-gen >/dev/null
 while [ "$(hostname -I)" = "" ]; do
-  1>&2 echo -en "${CROSS}${RD} No Network! "
+  echo 1>&2 -en "${CROSS}${RD} No Network! "
   sleep $RETRY_EVERY
   ((NUM--))
-  if [ $NUM -eq 0 ]
-  then
-    1>&2 echo -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"    
+  if [ $NUM -eq 0 ]; then
+    echo 1>&2 -e "${CROSS}${RD} No Network After $RETRY_NUM Tries${CL}"
     exit 1
   fi
 done
@@ -61,9 +60,12 @@ msg_ok "Network Connected: ${BL}$(hostname -I)"
 
 set +e
 alias die=''
-if nc -zw1 8.8.8.8 443; then  msg_ok "Internet Connected"; else  msg_error "Internet NOT Connected"; exit 1; fi;
+if nc -zw1 8.8.8.8 443; then msg_ok "Internet Connected"; else
+  msg_error "Internet NOT Connected"
+  exit 1
+fi
 RESOLVEDIP=$(nslookup "github.com" | awk -F':' '/^Address: / { matched = 1 } matched { print $2}' | xargs)
-if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure";  else msg_ok "DNS Resolved github.com to $RESOLVEDIP";  fi;
+if [[ -z "$RESOLVEDIP" ]]; then msg_error "DNS Lookup Failure"; else msg_ok "DNS Resolved github.com to $RESOLVEDIP"; fi
 alias die='EXIT=$? LINE=$LINENO error_exit'
 set -e
 
@@ -81,24 +83,24 @@ msg_info "Installing AdGuard Home"
 curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh &>/dev/null
 msg_ok "Installed AdGuard Home"
 
-PASS=$(grep -w "root" /etc/shadow | cut -b6);
-  if [[ $PASS != $ ]]; then
-msg_info "Customizing Container"
-rm /etc/motd
-rm /etc/update-motd.d/10-uname
-touch ~/.hushlogin
-GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
-mkdir -p $(dirname $GETTY_OVERRIDE)
-cat << EOF > $GETTY_OVERRIDE
+PASS=$(grep -w "root" /etc/shadow | cut -b6)
+if [[ $PASS != $ ]]; then
+  msg_info "Customizing Container"
+  rm /etc/motd
+  rm /etc/update-motd.d/10-uname
+  touch ~/.hushlogin
+  GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
+  mkdir -p $(dirname $GETTY_OVERRIDE)
+  cat <<EOF >$GETTY_OVERRIDE
 [Service]
 ExecStart=
 ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM
 EOF
-systemctl daemon-reload
-systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
-msg_ok "Customized Container"
-  fi
-  
+  systemctl daemon-reload
+  systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
+  msg_ok "Customized Container"
+fi
+
 msg_info "Cleaning up"
 apt-get autoremove >/dev/null
 apt-get autoclean >/dev/null

Some files were not shown because too many files changed in this diff