Skip to content

Commit 4ed7b49

Browse files
author
Kristiyan Ivanov
authored
Feature/ri 7158 uninstalling ri desktop installed from deb file doesnt work (#4667)
* RI-7158 - Uninstalling RI desktop installed from deb file doesn't work - added on remove hook to handle it. * RI-7158 - Uninstalling RI desktop installed from deb file doesn't work - added on remove hook to handle it.
1 parent 868a67c commit 4ed7b49

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

electron-builder.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@
123123
}
124124
},
125125
"deb": {
126-
"afterInstall": "scripts/deb-after-install.sh"
126+
"afterInstall": "scripts/deb-after-install.sh",
127+
"afterRemove": "scripts/deb-before-remove.sh"
127128
},
128129
"snap": {
129130
"plugs": ["default", "password-manager-service"],

scripts/deb-before-remove.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
set -e
3+
4+
OLD_INSTALL_PATH="/opt/Redis Insight"
5+
NEW_INSTALL_PATH="/opt/redisinsight"
6+
SYMLINK_PATH="/usr/bin/redisinsight"
7+
DESKTOP_FILE="/usr/share/applications/redisinsight.desktop"
8+
9+
RUNNING_PIDS=$(pgrep -f "$NEW_INSTALL_PATH/redisinsight" || pgrep -f "$OLD_INSTALL_PATH/redisinsight" || true)
10+
11+
for PID in $RUNNING_PIDS; do
12+
echo "Found running RedisInsight instance (PID: $PID), terminating..."
13+
kill $PID 2>/dev/null || true
14+
done
15+
16+
sleep 2
17+
18+
REMAINING_PIDS=$(pgrep -f "$NEW_INSTALL_PATH/redisinsight" || pgrep -f "$OLD_INSTALL_PATH/redisinsight" || true)
19+
for PID in $REMAINING_PIDS; do
20+
echo "Force killing remaining RedisInsight instance (PID: $PID)..."
21+
kill -9 $PID 2>/dev/null || true
22+
done
23+
24+
if [ -L "$SYMLINK_PATH" ]; then
25+
echo "Removing symlink: $SYMLINK_PATH"
26+
rm -f "$SYMLINK_PATH" || true
27+
fi
28+
29+
if [ -d "$NEW_INSTALL_PATH" ]; then
30+
echo "Removing directory: $NEW_INSTALL_PATH"
31+
rm -rf "$NEW_INSTALL_PATH" || true
32+
fi
33+
34+
if [ -d "$OLD_INSTALL_PATH" ]; then
35+
echo "Removing old directory: $OLD_INSTALL_PATH" #if it still exists for any reason
36+
rm -rf "$OLD_INSTALL_PATH" || true
37+
fi
38+
39+
if command -v update-desktop-database >/dev/null 2>&1; then
40+
echo "Updating desktop database..."
41+
update-desktop-database 2>/dev/null || true
42+
fi
43+
44+
echo "RedisInsight cleanup completed successfully"

0 commit comments

Comments
 (0)