diff --git a/src/pages/fileBrowser/fileBrowser.js b/src/pages/fileBrowser/fileBrowser.js index 48edd2ea2..24408c007 100644 --- a/src/pages/fileBrowser/fileBrowser.js +++ b/src/pages/fileBrowser/fileBrowser.js @@ -1046,31 +1046,23 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) { ); } - // Check for Terminal Home Directory storage try { - const isTerminalInstalled = await Terminal.isInstalled(); - if (typeof Terminal !== "undefined" && isTerminalInstalled) { - const isTerminalSupported = await Terminal.isSupported(); - - if (isTerminalSupported && isTerminalInstalled) { - const terminalHomeUrl = cordova.file.dataDirectory + "alpine/home"; - - // Check if this storage is not already in the list - const terminalStorageExists = allStorages.find( - (storage) => - storage.uuid === "terminal-home" || - storage.url === terminalHomeUrl, - ); + const terminalPublicUrl = cordova.file.dataDirectory + "public"; - if (!terminalStorageExists) { - util.pushFolder(allStorages, "Terminal Home", terminalHomeUrl, { - uuid: "terminal-home", - }); - } - } + // Check if this storage is not already in the list + const terminalPublicStorageExists = allStorages.find( + (storage) => + storage.uuid === "terminal-public" || + storage.url === terminalPublicUrl, + ); + + if (!terminalPublicStorageExists) { + util.pushFolder(allStorages, "Terminal Public", terminalPublicUrl, { + uuid: "terminal-public", + }); } - } catch (error) { - console.error("Error checking Terminal installation:", error); + } catch (err) { + console.error("Error while adding public directory", err); } try { diff --git a/src/plugins/terminal/scripts/init-sandbox.sh b/src/plugins/terminal/scripts/init-sandbox.sh index 3b8a7c3d8..90154f793 100644 --- a/src/plugins/terminal/scripts/init-sandbox.sh +++ b/src/plugins/terminal/scripts/init-sandbox.sh @@ -4,6 +4,26 @@ mkdir -p "$PREFIX/tmp" mkdir -p "$PREFIX/alpine/tmp" mkdir -p "$PREFIX/public" +SRC1="$PREFIX/alpine/home" +SRC2="$PREFIX/alpine/root" +DEST="$PREFIX/public" + +mkdir -p "$DEST" + +move_all() { + SRC="$1" + + [ -d "$SRC" ] || return 0 + + # Only continue if directory is not empty + [ "$(find "$SRC" -mindepth 1 -maxdepth 1 | head -n 1)" ] || return 0 + + find "$SRC" -mindepth 1 -maxdepth 1 -exec mv -f {} "$DEST"/ \; +} + +move_all "$SRC1" +move_all "$SRC2" + export PROOT_TMP_DIR=$PREFIX/tmp if [ "$FDROID" = "true" ]; then @@ -63,6 +83,8 @@ ARGS="$ARGS -b /proc" ARGS="$ARGS -b /sys" ARGS="$ARGS -b $PREFIX" ARGS="$ARGS -b $PREFIX/public:/public" +ARGS="$ARGS -b $PREFIX/public:/home" +ARGS="$ARGS -b $PREFIX/public:/root" ARGS="$ARGS -b $PREFIX/alpine/tmp:/dev/shm"