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
3 changes: 2 additions & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@
}
},
"deb": {
"afterInstall": "scripts/deb-after-install.sh"
"afterInstall": "scripts/deb-after-install.sh",
"afterRemove": "scripts/deb-before-remove.sh"
},
"snap": {
"plugs": ["default", "password-manager-service"],
Expand Down
44 changes: 44 additions & 0 deletions scripts/deb-before-remove.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
set -e

OLD_INSTALL_PATH="/opt/Redis Insight"
NEW_INSTALL_PATH="/opt/redisinsight"
SYMLINK_PATH="/usr/bin/redisinsight"
DESKTOP_FILE="/usr/share/applications/redisinsight.desktop"

RUNNING_PIDS=$(pgrep -f "$NEW_INSTALL_PATH/redisinsight" || pgrep -f "$OLD_INSTALL_PATH/redisinsight" || true)

for PID in $RUNNING_PIDS; do
echo "Found running RedisInsight instance (PID: $PID), terminating..."
kill $PID 2>/dev/null || true
done

sleep 2

REMAINING_PIDS=$(pgrep -f "$NEW_INSTALL_PATH/redisinsight" || pgrep -f "$OLD_INSTALL_PATH/redisinsight" || true)
for PID in $REMAINING_PIDS; do
echo "Force killing remaining RedisInsight instance (PID: $PID)..."
kill -9 $PID 2>/dev/null || true
done

if [ -L "$SYMLINK_PATH" ]; then
echo "Removing symlink: $SYMLINK_PATH"
rm -f "$SYMLINK_PATH" || true
fi

if [ -d "$NEW_INSTALL_PATH" ]; then
echo "Removing directory: $NEW_INSTALL_PATH"
rm -rf "$NEW_INSTALL_PATH" || true
fi

if [ -d "$OLD_INSTALL_PATH" ]; then
echo "Removing old directory: $OLD_INSTALL_PATH" #if it still exists for any reason
rm -rf "$OLD_INSTALL_PATH" || true
fi

if command -v update-desktop-database >/dev/null 2>&1; then
echo "Updating desktop database..."
update-desktop-database 2>/dev/null || true
fi

echo "RedisInsight cleanup completed successfully"
Loading