2
2
set -ex
3
3
4
4
# 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
9
7
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
13
16
fi
14
17
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
18
23
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
22
29
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 "
25
32
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"
30
35
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"
36
39
37
40
echo " RedisInsight post-installation setup completed successfully"
0 commit comments