Add undo uninstall module feature 添加撤销卸载模块功能#2920
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ability to undo a module uninstallation before the system reboots. Users can now revert an uninstall operation using the ksud module undo-uninstall <id> command or through the manager UI.
Key Changes:
- Refactored the uninstall logic into a shared
_uninstall_modulefunction that handles both uninstall and undo operations - Added new CLI command
module undo-uninstall <id>to support the undo functionality - Updated the UI to show an "undo" button when a module is marked for removal
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| userspace/ksud/src/module.rs | Refactored module uninstall logic into _uninstall_module helper function that supports both uninstall and undo operations; added undo_uninstall_module public function |
| userspace/ksud/src/cli.rs | Added UndoUninstall command variant and wired it to the new undo_uninstall_module function |
| manager/app/src/main/res/values/strings.xml | Added English strings for the undo functionality (undo label and success/failure messages) |
| manager/app/src/main/res/values-zh-rCN/strings.xml | Added Chinese translations for the undo functionality |
| manager/app/src/main/java/me/weishu/kernelsu/ui/util/KsuCli.kt | Added undoUninstallModule function to execute the undo-uninstall CLI command |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Module.kt | Added UI support for undo operation - displays undo button when module is marked for removal, handles undo action and shows appropriate feedback messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
db29875 to
9448977
Compare
|
感觉似乎没有什么必要,他如果想撤销,可以直接重新安装 |
模块在重新安装时安装脚本还是会执行一遍,可能会更新配置什么之类的。模块是下次启动后开始卸载的, |
你说的对,当前的 overlayfs 实现的确如此。但是我们计划实现 metamodule,将模块的 mount 能力释放给第三方实现,如果 metamodule 的 mount 用其他实现方式,可能直接当场就卸载,届时再实现 undo 就很麻烦了 |
关于metamodule,能问几个问题吗?
|
兼容;只是把 mount 交给第三方,可以用 overlayfs,也可以用 bind mount; |
|
我们已经合并 #2929,当前情况下,卸载模块仅仅是放置一个 flag 到模块目录;因此依然可以支持撤销操作,如果你有兴趣,可以在此基础上添加,谢谢! |
9448977 to
dfd7ecb
Compare
已更新 |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dfd7ecb to
e9a9983
Compare
|
改了一下逻辑,和模块启用/禁用和卸载一样,反复撤销不再报错而是直接跳过 |
e9a9983 to
e5ad83e
Compare
75458b4 to
ea80b4c
Compare
- Consolidated duplicate if-else branches in ModuleItem composable - Reduced code duplication from 66 lines to 38 lines (28 lines removed) - Used inline conditionals for onClick, backgroundColor, icon, and text - Maintains same functionality with better maintainability - Fixed English string issues in values/strings.xml - Capitalized "undo" to "Undo" for UI consistency - Improved grammar: "Succeed undo %s uninstall" → "Successfully canceled uninstall of %s" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
模块在卸载后,重启前可以在管理器中撤销本次卸载操作 命令如下 ```shell ksud module undo-uninstall <id> ``` --------- Co-authored-by: weishu <twsxtd@gmail.com> Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
模块在卸载后,重启前可以在管理器中撤销本次卸载操作 命令如下 ```shell ksud module undo-uninstall <id> ``` --------- Co-authored-by: weishu <twsxtd@gmail.com> Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
模块在卸载后,重启前可以在管理器中撤销本次卸载操作 命令如下 ```shell ksud module undo-uninstall <id> ``` --------- Co-authored-by: weishu <twsxtd@gmail.com> Signed-off-by: u9521 <63995396+u9521@users.noreply.github.com>
模块在卸载后,重启前可以在管理器中撤销本次卸载操作
命令如下