Skip to content

Commit d0119cc

Browse files
committed
feat: add cleanup function for stale AppImage mounts during installation
1 parent 7b4a7c1 commit d0119cc

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

apps/installer/scripts/install.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,25 @@ BIN_DIR="\$HOME/.local/bin"
825825
DESKTOP_FILE="\$HOME/.local/share/applications/pairux.desktop"
826826
ICON_FILE="\$HOME/.local/share/icons/hicolor/256x256/apps/pairux.png"
827827
828+
cleanup_stale_appimage_mounts() {
829+
local mount_root="\$HOME/.pairux/tmp"
830+
[ -d "\$mount_root" ] || return 0
831+
832+
local mount_dir
833+
for mount_dir in "\$mount_root"/.mount_PairUX*; do
834+
[ -e "\$mount_dir" ] || continue
835+
836+
# If the mount is stale ("Transport endpoint is not connected"), unmount
837+
# and remove it so AppImage extract/run can recover on update.
838+
if ! ls -ld "\$mount_dir" >/dev/null 2>&1; then
839+
fusermount3 -u -z "\$mount_dir" >/dev/null 2>&1 || \
840+
fusermount -u -z "\$mount_dir" >/dev/null 2>&1 || \
841+
umount -l "\$mount_dir" >/dev/null 2>&1 || true
842+
rm -rf "\$mount_dir" >/dev/null 2>&1 || true
843+
fi
844+
done
845+
}
846+
828847
case "\${1-}" in
829848
-h|--help)
830849
echo "Usage: pairux [options]"
@@ -923,6 +942,7 @@ case "\${1-}" in
923942
else
924943
echo "Updating PairUX to v\$LATEST..."
925944
fi
945+
cleanup_stale_appimage_mounts
926946
if command -v curl >/dev/null 2>&1; then
927947
curl -fsSL "\$INSTALLER_URL/install.sh" | bash
928948
elif command -v wget >/dev/null 2>&1; then

0 commit comments

Comments
 (0)