Skip to content

Commit 3e7390e

Browse files
author
KIvanow
committed
RI-6690 alternative skipping logic for the after install script, testing setImmediate hack for the quit and install update
1 parent 6d91057 commit 3e7390e

File tree

2 files changed

+23
-50
lines changed

2 files changed

+23
-50
lines changed

redisinsight/desktop/src/lib/window/window.handlers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export const initWindowIPCHandlers = () => {
110110
})
111111
})
112112
ipcMain.handle(IpcInvokeEvent.appRestart, async () => {
113-
quitAndInstallUpdate()
113+
setImmediate(() => {
114+
quitAndInstallUpdate()
115+
})
114116
})
115117
}

scripts/deb-after-install.sh

Lines changed: 20 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,32 @@
11
#!/bin/bash
2-
# Exit on error but continue past command failures with || true
3-
set -e
2+
set -ex
43

5-
# Define paths
6-
OLD_INSTALL_PATH="/opt/Redis Insight" # Path with space
7-
NEW_INSTALL_PATH="/opt/redisinsight" # New path without space
4+
OLD_INSTALL_PATH="/opt/Redis Insight"
5+
NEW_INSTALL_PATH="/opt/redisinsight"
86
DESKTOP_FILE="/usr/share/applications/redisinsight.desktop"
97

10-
# Simple auto-update detection - if we have the new path but not the old path
11-
if [ -d "$NEW_INSTALL_PATH" ] && [ ! -d "$OLD_INSTALL_PATH" ]; then
12-
echo "Auto-update scenario detected"
13-
14-
# Always update the symlink
15-
sudo ln -sf "$NEW_INSTALL_PATH/redisinsight" "/usr/bin/redisinsight" || true
16-
17-
# Set permissions only if files exist
18-
if [ -f "$NEW_INSTALL_PATH/redisinsight" ]; then
19-
sudo chmod +x "$NEW_INSTALL_PATH/redisinsight" || true
20-
fi
21-
22-
if [ -f "$NEW_INSTALL_PATH/chrome-sandbox" ]; then
23-
sudo chown root:root "$NEW_INSTALL_PATH/chrome-sandbox" || true
24-
sudo chmod 4755 "$NEW_INSTALL_PATH/chrome-sandbox" || true
25-
fi
26-
27-
echo "RedisInsight auto-update post-install completed"
8+
# Skip migration if new structure already exists
9+
if [ -d "$NEW_INSTALL_PATH" ]; then
10+
echo "New path already exists. Assuming clean install or previous fix. Skipping migration."
2811
exit 0
2912
fi
3013

31-
# Check if old directory exists and rename it
14+
# Proceed only if old path exists
3215
if [ -d "$OLD_INSTALL_PATH" ]; then
33-
echo "Migrating from old installation path"
34-
if [ -d "$NEW_INSTALL_PATH" ]; then
35-
echo "WARNING: Both old and new paths exist. Removing new path first."
36-
sudo rm -rf "$NEW_INSTALL_PATH" || true
37-
fi
38-
sudo mv "$OLD_INSTALL_PATH" "$NEW_INSTALL_PATH" || true
39-
fi
40-
41-
# Update desktop file to use new path if it exists
42-
if [ -f "$DESKTOP_FILE" ]; then
43-
echo "Updating desktop file"
44-
sudo sed -i "s|$OLD_INSTALL_PATH|$NEW_INSTALL_PATH|g" "$DESKTOP_FILE" || true
45-
fi
16+
echo "Old path found. Migrating to new path..."
17+
mv "$OLD_INSTALL_PATH" "$NEW_INSTALL_PATH"
4618

47-
# Always update the symlink
48-
sudo ln -sf "$NEW_INSTALL_PATH/redisinsight" "/usr/bin/redisinsight" || true
19+
if [ -f "$DESKTOP_FILE" ]; then
20+
echo "Updating desktop file"
21+
sed -i "s|$OLD_INSTALL_PATH|$NEW_INSTALL_PATH|g" "$DESKTOP_FILE"
22+
fi
4923

50-
# Set executable permissions
51-
if [ -f "$NEW_INSTALL_PATH/redisinsight" ]; then
52-
sudo chmod +x "$NEW_INSTALL_PATH/redisinsight" || true
53-
fi
24+
ln -sf "$NEW_INSTALL_PATH/redisinsight" "/usr/bin/redisinsight"
25+
chmod +x "$NEW_INSTALL_PATH/redisinsight"
26+
chown root:root "$NEW_INSTALL_PATH/chrome-sandbox"
27+
chmod 4755 "$NEW_INSTALL_PATH/chrome-sandbox"
5428

55-
# Set correct ownership and permissions for chrome-sandbox
56-
if [ -f "$NEW_INSTALL_PATH/chrome-sandbox" ]; then
57-
sudo chown root:root "$NEW_INSTALL_PATH/chrome-sandbox" || true
58-
sudo chmod 4755 "$NEW_INSTALL_PATH/chrome-sandbox" || true
29+
echo "Migration completed"
30+
else
31+
echo "Neither old nor new path exists. Unexpected state. Skipping."
5932
fi
60-
61-
echo "RedisInsight post-installation setup completed successfully"

0 commit comments

Comments
 (0)