Skip to content

Commit b4f88c8

Browse files
author
KIvanow
committed
RI-6690 trying alternative approach to scripting - back to the basics
1 parent 2a8e924 commit b4f88c8

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

scripts/deb-after-install.sh

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,39 @@
22
set -ex
33

44
# Define paths
5-
OLD_INSTALL_PATH="/opt/Redis Insight"
6-
LAUNCHER_PATH="/opt/redisinsight-launcher"
7-
8-
# Update desktop file to use our launcher
5+
OLD_INSTALL_PATH="/opt/Redis Insight" # Path with space
6+
NEW_INSTALL_PATH="/opt/redisinsight" # New path without space
97
DESKTOP_FILE="/usr/share/applications/redisinsight.desktop"
10-
if [ -f "$DESKTOP_FILE" ]; then
11-
echo "Updating desktop file to use launcher"
12-
sudo sed -i "s|Exec=.*|Exec=$LAUNCHER_PATH|g" "$DESKTOP_FILE"
8+
9+
# Auto-update scenario detection:
10+
# If NEW_INSTALL_PATH exists and OLD_INSTALL_PATH doesn't, assume we're running
11+
# after an auto-update and just exit successfully
12+
if [ -d "$NEW_INSTALL_PATH" ] && [ ! -d "$OLD_INSTALL_PATH" ]; then
13+
echo "Detected existing installation at $NEW_INSTALL_PATH"
14+
echo "This appears to be an auto-update scenario - no migration needed"
15+
exit 0
1316
fi
1417

15-
# Create simple launcher script that directly uses full path
16-
sudo tee "$LAUNCHER_PATH" > /dev/null << EOF
17-
#!/bin/bash
18+
# Check if old directory exists and rename it
19+
if [ -d "$OLD_INSTALL_PATH" ]; then
20+
echo "Renaming $OLD_INSTALL_PATH to $NEW_INSTALL_PATH"
21+
sudo mv "$OLD_INSTALL_PATH" "$NEW_INSTALL_PATH"
22+
fi
1823

19-
echo "Launching RedisInsight with args: \$@"
20-
exec "$OLD_INSTALL_PATH/redisinsight" "\$@"
21-
EOF
24+
# Update desktop file to use new path
25+
if [ -f "$DESKTOP_FILE" ]; then
26+
echo "Updating desktop file to use new path"
27+
sudo sed -i "s|$OLD_INSTALL_PATH|$NEW_INSTALL_PATH|g" "$DESKTOP_FILE"
28+
fi
2229

23-
# Make the launcher script executable
24-
sudo chmod +x "$LAUNCHER_PATH"
30+
# Update binary link
31+
sudo ln -sf "$NEW_INSTALL_PATH/redisinsight" "/usr/bin/redisinsight"
2532

26-
# Set basic executable permissions (on the original location)
27-
if [ -f "$OLD_INSTALL_PATH/redisinsight" ]; then
28-
sudo chmod +x "$OLD_INSTALL_PATH/redisinsight"
29-
fi
33+
# Set basic executable permissions
34+
sudo chmod +x "$NEW_INSTALL_PATH/redisinsight"
3035

31-
# Set correct ownership and permissions for chrome-sandbox (on the original location)
32-
if [ -f "$OLD_INSTALL_PATH/chrome-sandbox" ]; then
33-
sudo chown root:root "$OLD_INSTALL_PATH/chrome-sandbox"
34-
sudo chmod 4755 "$OLD_INSTALL_PATH/chrome-sandbox"
35-
fi
36+
# Set correct ownership and permissions for chrome-sandbox
37+
sudo chown root:root "$NEW_INSTALL_PATH/chrome-sandbox"
38+
sudo chmod 4755 "$NEW_INSTALL_PATH/chrome-sandbox"
3639

3740
echo "RedisInsight post-installation setup completed successfully"

0 commit comments

Comments
 (0)