From 552cff8a2c889b257ac565431b66b10c09836cc4 Mon Sep 17 00:00:00 2001 From: tteckster Date: Wed, 28 Dec 2022 06:41:43 -0500 Subject: [PATCH] fuse-overlayfs option (#876) CasaOS Umbrel --- ct/casaos-v4.sh | 18 ++++++++++++++---- ct/umbrel-v4.sh | 18 ++++++++++++++---- setup/casaos-install.sh | 7 +++++++ setup/umbrel-install.sh | 7 +++++++ 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/ct/casaos-v4.sh b/ct/casaos-v4.sh index 63819aa5..c3d54ea9 100644 --- a/ct/casaos-v4.sh +++ b/ct/casaos-v4.sh @@ -98,8 +98,10 @@ function default_settings() { MAC="" echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" VLAN="" - echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" + echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" SSH="no" + echo -e "${DGN}(ZFS) Enable Fuse Overlayfs: ${BGN}No${CL}" + FUSE="no" echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}" VERB="no" echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" @@ -251,6 +253,13 @@ function advanced_settings() { echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" SSH="no" fi + if (whiptail --defaultno --title "FUSE OVERLAYFS" --yesno "(ZFS) Enable Fuse Overlayfs?" 10 58); then + echo -e "${DGN}(ZFS) Enable Fuse Overlayfs: ${BGN}Yes${CL}" + FUSE="yes" + else + echo -e "${DGN}(ZFS) Enable Fuse Overlayfs: ${BGN}No${CL}" + FUSE="no" + fi if (whiptail --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then echo -e "${DGN}Enable Verbose Mode: ${BGN}Yes${CL}" VERB="yes" @@ -281,13 +290,14 @@ function start_script() { clear start_script if [ "$VERB" == "yes" ]; then set -x; fi -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" +if [ "$FUSE" == "yes" ]; then +FEATURES="fuse=1,keyctl=1,nesting=1" else - FEATURES="nesting=1" +FEATURES="keyctl=1,nesting=1" fi TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null +export ST=$FUSE export VERBOSE=$VERB export SSH_ROOT=${SSH} export CTID=$CT_ID diff --git a/ct/umbrel-v4.sh b/ct/umbrel-v4.sh index 391b4578..c19dce93 100644 --- a/ct/umbrel-v4.sh +++ b/ct/umbrel-v4.sh @@ -98,8 +98,10 @@ function default_settings() { MAC="" echo -e "${DGN}Using VLAN Tag: ${BGN}Default${CL}" VLAN="" - echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" + echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" SSH="no" + echo -e "${DGN}(ZFS) Enable Fuse Overlayfs: ${BGN}No${CL}" + FUSE="no" echo -e "${DGN}Enable Verbose Mode: ${BGN}No${CL}" VERB="no" echo -e "${BL}Creating a ${APP} LXC using the above default settings${CL}" @@ -251,6 +253,13 @@ function advanced_settings() { echo -e "${DGN}Enable Root SSH Access: ${BGN}No${CL}" SSH="no" fi + if (whiptail --defaultno --title "FUSE OVERLAYFS" --yesno "(ZFS) Enable Fuse Overlayfs?" 10 58); then + echo -e "${DGN}(ZFS) Enable Fuse Overlayfs: ${BGN}Yes${CL}" + FUSE="yes" + else + echo -e "${DGN}(ZFS) Enable Fuse Overlayfs: ${BGN}No${CL}" + FUSE="no" + fi if (whiptail --defaultno --title "VERBOSE MODE" --yesno "Enable Verbose Mode?" 10 58); then echo -e "${DGN}Enable Verbose Mode: ${BGN}Yes${CL}" VERB="yes" @@ -281,13 +290,14 @@ function start_script() { clear start_script if [ "$VERB" == "yes" ]; then set -x; fi -if [ "$CT_TYPE" == "1" ]; then - FEATURES="nesting=1,keyctl=1" +if [ "$FUSE" == "yes" ]; then +FEATURES="fuse=1,keyctl=1,nesting=1" else - FEATURES="nesting=1" +FEATURES="keyctl=1,nesting=1" fi TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null +export ST=$FUSE export VERBOSE=$VERB export SSH_ROOT=${SSH} export CTID=$CT_ID diff --git a/setup/casaos-install.sh b/setup/casaos-install.sh index d2f383f9..35e88e14 100644 --- a/setup/casaos-install.sh +++ b/setup/casaos-install.sh @@ -96,6 +96,13 @@ cat >$DOCKER_CONFIG_PATH <<'EOF' EOF msg_info "Installing CasaOS (Patience)" +if [ "$ST" == "yes" ]; then +VER=$(curl -s https://api.github.com/repos/containers/fuse-overlayfs/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +cd /usr/local/bin +curl -sSL -o fuse-overlayfs https://github.com/containers/fuse-overlayfs/releases/download/$VER/fuse-overlayfs-x86_64 +chmod 755 /usr/local/bin/fuse-overlayfs +cd ~ +fi wget -qO- https://get.casaos.io | bash &>/dev/null msg_ok "Installed CasaOS" diff --git a/setup/umbrel-install.sh b/setup/umbrel-install.sh index 872a0907..95c1c376 100644 --- a/setup/umbrel-install.sh +++ b/setup/umbrel-install.sh @@ -95,6 +95,13 @@ cat >$DOCKER_CONFIG_PATH <<'EOF' EOF msg_info "Installing Umbrel (Patience)" +if [ "$ST" == "yes" ]; then +VER=$(curl -s https://api.github.com/repos/containers/fuse-overlayfs/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') +cd /usr/local/bin +curl -sSL -o fuse-overlayfs https://github.com/containers/fuse-overlayfs/releases/download/$VER/fuse-overlayfs-x86_64 +chmod 755 /usr/local/bin/fuse-overlayfs +cd ~ +fi curl -sL https://umbrel.sh | bash &>/dev/null systemctl daemon-reload systemctl enable --now umbrel-startup.service &>/dev/null