Skip to content

Commit 19804a7

Browse files
committed
feat: enhance AppImage execution by sanitizing runtime directories and setting TMPDIR
1 parent 69e8af0 commit 19804a7

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

apps/installer/scripts/install.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,20 @@ if [ -x "\$APPIMAGE" ]; then
587587
# emit "open dir error: No such file or directory" on Linux.
588588
cd "\$HOME" 2>/dev/null || cd / 2>/dev/null || true
589589
590+
# AppImage can also fail with the same error when inherited runtime/temp
591+
# dirs point to deleted paths (common after terminal multiplexers/shells
592+
# survive logouts or tmp cleanup). Sanitize them before exec.
593+
if [ -n "\${XDG_RUNTIME_DIR-}" ] && [ ! -d "\$XDG_RUNTIME_DIR" ]; then
594+
unset XDG_RUNTIME_DIR
595+
fi
596+
PAIRUX_TMP_DIR="\$HOME/.pairux/tmp"
597+
mkdir -p "\$PAIRUX_TMP_DIR" 2>/dev/null || true
598+
if [ -d "\$PAIRUX_TMP_DIR" ] && [ -w "\$PAIRUX_TMP_DIR" ]; then
599+
export TMPDIR="\$PAIRUX_TMP_DIR"
600+
elif [ -z "\${TMPDIR-}" ] || [ ! -d "\$TMPDIR" ] || [ ! -w "\$TMPDIR" ]; then
601+
export TMPDIR="/tmp"
602+
fi
603+
590604
# If FUSE is unavailable or inaccessible (common in restricted/containerized
591605
# environments), fall back to extract-and-run mode so the AppImage can still
592606
# launch. A simple -r/-w check is not enough because /dev/fuse may exist but

0 commit comments

Comments
 (0)