From 3d6e1a27707b92c1ee61de4bd3d675ded08cd577 Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Thu, 23 Mar 2023 07:33:03 -0400
Subject: [PATCH] Update build.func

update
---
 misc/build.func | 34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/misc/build.func b/misc/build.func
index 977d4706..79e87246 100644
--- a/misc/build.func
+++ b/misc/build.func
@@ -87,6 +87,9 @@ echo_default() {
   echo -e "${DGN}Using MAC Address: ${BGN}Default${CL}"
   echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}"
   echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}"
+  if [[ "$APP" == "Docker" || "$APP" == "Umbrel" || "$APP" == "CasaOS" || "$APP" == "Home Assistant" ]]; then
+    echo -e "${DGN}Enable Fuse Overlayfs (ZFS): ${BGN}No${CL}"
+  fi
   echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}"
   echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}"
 }
@@ -300,6 +303,15 @@ advanced_settings() {
   fi
   echo -e "${DGN}Enable Root SSH Access: ${BGN}$SSH${CL}"
 
+  if [[ "$APP" == "Docker" || "$APP" == "Umbrel" || "$APP" == "CasaOS" || "$APP" == "Home Assistant" ]]; then
+    if (whiptail --defaultno --title "FUSE OVERLAYFS" --yesno "(ZFS) Enable Fuse Overlayfs?" 10 58); then
+      FUSE="yes"
+    else
+      FUSE="no"
+    fi
+    echo -e "${DGN}Enable Fuse Overlayfs (ZFS): ${BGN}$FUSE${CL}"
+  fi
+
   if (whiptail --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then
     VERB="yes"
   else
@@ -355,15 +367,29 @@ start() {
 
 build_container() {
   if [ "$VERB" == "yes" ]; then set -x; fi
-  if [ "$CT_TYPE" == "1" ]; then
-    FEATURES="nesting=1,keyctl=1"
-  else
-    FEATURES="nesting=1"
+
+  if [[ "$APP" == "Docker" || "$APP" == "Umbrel" || "$APP" == "CasaOS" || "$APP" == "Home Assistant" ]]; then
+    if [ "$FUSE" == "yes" ]; then
+      FEATURES="fuse=1,keyctl=1,nesting=1"
+    else
+      FEATURES="keyctl=1,nesting=1"
+    fi
   fi
+  if [[ "$APP" != "Docker" && "$APP" != "Umbrel" && "$APP" != "CasaOS" && "$APP" != "Home Assistant" ]]; then
+    if [ "$CT_TYPE" == "1" ]; then
+      FEATURES="keyctl=1,nesting=1"
+    else
+      FEATURES="nesting=1"
+    fi
+  fi
+
   TEMP_DIR=$(mktemp -d)
   pushd $TEMP_DIR >/dev/null
   export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/install.func)"
   export tz="$timezone"
+  if [[ "$APP" == "Docker" || "$APP" == "Umbrel" || "$APP" == "CasaOS" || "$APP" == "Home Assistant" ]]; then
+    export ST="$FUSE"
+  fi
   export DISABLEIPV6="$DISABLEIP6"
   export APPLICATION="$APP"
   export VERBOSE="$VERB"