修复使用 Deb 安装时仍会提示更新的问题 & 支持手动禁用更新 & 支持在非官方版本显示更新已被禁用#6174
Conversation
CiiLu
commented
Jun 14, 2026
closes #6136
|
这是否是#5571 (comment) 变相的实现😂😂😂 |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for disabling update checks or delegating them to external package managers via system properties, updating the settings UI to display relevant status messages, and documenting these new options. The review feedback highlights a variable typo (alretLineButton instead of alertLineButton) in SettingsPage.java, suggests using the SHOULD_CHECK_UPDATE constant in UpdateChecker.java for better efficiency, and points out spelling errors in the JVM parameter names (uptate instead of update) across the documentation files.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
乍一看感觉改了好多行,不太好审。要不只改新加的两行?下同。
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
|
我希望在 #6122 完成后,通过引入新的配置文件来提供包管理器相关的元数据,而不是通过 JVM 参数传递这些内容。 |
|
@CiiLu review |
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to disable update checks or indicate that updates are managed by an external package manager (such as apt) via new JVM parameters (hmcl.update.disable and hmcl.update.packageManager). It updates the settings UI, update checker logic, Debian package build script, and documentation accordingly. However, appending all command-line arguments directly to JVM options in HMCLauncher.sh is highly risky and can cause JVM crashes when application arguments are passed. It is recommended to pass these configurations via environment variables instead of command-line JVM properties, and update UpdateChecker to read from both system properties and environment variables.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if [ $# -gt 0 ]; then | ||
| _HMCL_VM_OPTIONS="$_HMCL_VM_OPTIONS $*" | ||
| fi |
There was a problem hiding this comment.
在 HMCLauncher.sh 中,将 $*(所有命令行参数)直接追加到 _HMCL_VM_OPTIONS 是非常危险的。因为 _HMCL_VM_OPTIONS 会在 -jar 参数之前传递给 java 命令(作为 JVM 参数)。
如果用户在启动时传入了任何应用程序参数(例如自定义工作目录、版本选择等),JVM 会尝试将其解析为 JVM 参数,从而导致 Unrecognized option 错误并使 JVM 崩溃启动失败。
为了解决这个问题,建议不要通过命令行参数传递 -Dhmcl.update.packageManager=apt,而是改用环境变量(例如 HMCL_UPDATE_PACKAGE_MANAGER),这样既能避免污染命令行参数,又不需要在 HMCLauncher.sh 中使用这种不安全的追加方式。
| export HMCL_DEPENDENCIES_DIR="$HMCL_USER_HOME/dependencies" | ||
| fi | ||
| exec %s "$@" | ||
| exec %s "$@" -Dhmcl.update.packageManager=apt |
| public static final String PACKAGE_MANAGER_PROPERTY = System.getProperty("hmcl.update.packageManager", ""); | ||
| public static final String DISABLE_UPDATE_PROPERTY = System.getProperty("hmcl.update.disable", ""); |
There was a problem hiding this comment.
配合 CreateDeb.java 的修改,在 UpdateChecker 中同时支持从系统属性和环境变量中读取 hmcl.update.packageManager 和 hmcl.update.disable。这样既能解决 Deb 包安装时的更新提示问题,也为用户提供了通过环境变量禁用更新的灵活方式。
| public static final String PACKAGE_MANAGER_PROPERTY = System.getProperty("hmcl.update.packageManager", ""); | |
| public static final String DISABLE_UPDATE_PROPERTY = System.getProperty("hmcl.update.disable", ""); | |
| public static final String PACKAGE_MANAGER_PROPERTY = System.getProperty("hmcl.update.packageManager", System.getenv("HMCL_UPDATE_PACKAGE_MANAGER") != null ? System.getenv("HMCL_UPDATE_PACKAGE_MANAGER") : ""); | |
| public static final String DISABLE_UPDATE_PROPERTY = System.getProperty("hmcl.update.disable", System.getenv("HMCL_UPDATE_DISABLE") != null ? System.getenv("HMCL_UPDATE_DISABLE") : ""); |