Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 14 additions & 22 deletions src/pages/fileBrowser/fileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Comment thread
RohitKushvaha01 marked this conversation as resolved.
Comment thread
RohitKushvaha01 marked this conversation as resolved.

try {
Expand Down
22 changes: 22 additions & 0 deletions src/plugins/terminal/scripts/init-sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment thread
RohitKushvaha01 marked this conversation as resolved.

export PROOT_TMP_DIR=$PREFIX/tmp

if [ "$FDROID" = "true" ]; then
Expand Down Expand Up @@ -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"
Comment thread
RohitKushvaha01 marked this conversation as resolved.
ARGS="$ARGS -b $PREFIX/alpine/tmp:/dev/shm"


Expand Down