Installation and Uninstallation
App installation and uninstallation
This document describes the installation and uninstallation flow of GM Desktop apps in detail, helping developers understand the complete app lifecycle management process.
App installation
Installation flow
When a user installs an app from the App Center, the system performs the following steps:
- Download the app package: download the app installer package to the user's server
- Extract and install: extract it automatically into the designated directory
- Directory structure: the app is installed to the following path:
/.__gmssh/plugin/{组织名}/{应用名}/- Create a desktop shortcut
Notes on the installation directory
{组织名}: the unique identifier of the developer or organization{应用名}: the unique name of the app
Things to watch
- Make sure the app name you develop stays unique within the organization
- Avoid directory names that the system reserves
- The app name must follow file system naming rules
App uninstallation
Uninstallation flow
The uninstallation process contains the following steps:
- Check for an uninstall script: the system looks for an
uninstall.shfile in the app directory - Run the uninstall script: if an uninstall script exists, the system runs it automatically
- Clean up app files: whether app data is removed depends on the user's choice
- Delete the app directory: when the sh script finishes, the app directory is deleted
Environment variable configuration
Before running the uninstall.sh script, the system sets the following environment variables:
| Variable | Type | Description |
|---|---|---|
IsClean | boolean | Whether the user chose to clear the app data |
true: the user ticked "Also delete app data (including settings/local files)"false: the user did not tick it, so the app data is kept
Uninstall script example
Create an uninstall.sh file to handle the uninstall logic:
#!/bin/bash
# Stop the app service
echo "正在停止应用服务..."
# Add the command that stops the service here
# Use the IsClean environment variable to decide whether to clear data
if [ "$IsClean" = "true" ]; then
echo "清除应用数据..."
# Delete the configuration files
rm -rf ./config/
# Delete the log files
rm -rf ./logs/
# Delete the user data
rm -rf ./data/
else
echo "保留应用数据"
fi
echo "应用卸载完成"Notes on the user interface
Users see the following option when they uninstall an app:

When the user ticks "Also delete app data (including settings/local files)", the IsClean environment variable is set to true.
Development advice
- Always provide an
uninstall.shscript so the app can be uninstalled correctly - Handle service shutdown and resource cleanup properly in the uninstall script
- Handle keeping or deleting user data based on the
IsCleanvariable - Add appropriate log output to make troubleshooting easier
