Skip to content

Conversation

@u9521
Copy link
Contributor

@u9521 u9521 commented Nov 12, 2025

模块在卸载后,重启前可以在管理器中撤销本次卸载操作
命令如下

ksud module undo-uninstall <id>

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_module function 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.

@u9521 u9521 force-pushed the undo-uninstall-module branch 2 times, most recently from db29875 to 9448977 Compare November 13, 2025 11:30
@tiann
Copy link
Owner

tiann commented Nov 14, 2025

感觉似乎没有什么必要,他如果想撤销,可以直接重新安装

@u9521
Copy link
Contributor Author

u9521 commented Nov 14, 2025

感觉似乎没有什么必要,他如果想撤销,可以直接重新安装

模块在重新安装时安装脚本还是会执行一遍,可能会更新配置什么之类的。模块是下次启动后开始卸载的,一切在没发生前都来得及,是吗

@tiann
Copy link
Owner

tiann commented Nov 14, 2025

感觉似乎没有什么必要,他如果想撤销,可以直接重新安装

模块在重新安装时安装脚本还是会执行一遍,可能会更新配置什么之类的。模块是下次启动后开始卸载的,一切在没发生前都来得及,是吗

你说的对,当前的 overlayfs 实现的确如此。但是我们计划实现 metamodule,将模块的 mount 能力释放给第三方实现,如果 metamodule 的 mount 用其他实现方式,可能直接当场就卸载,届时再实现 undo 就很麻烦了

@u9521
Copy link
Contributor Author

u9521 commented Nov 14, 2025

感觉似乎没有什么必要,他如果想撤销,可以直接重新安装

模块在重新安装时安装脚本还是会执行一遍,可能会更新配置什么之类的。模块是下次启动后开始卸载的,一切在没发生前都来得及,是吗

你说的对,当前的 overlayfs 实现的确如此。但是我们计划实现 metamodule,将模块的 mount 能力释放给第三方实现,如果 metamodule 的 mount 用其他实现方式,可能直接当场就卸载,届时再实现 undo 就很麻烦了

关于metamodule,能问几个问题吗?

  1. 是否还会兼容magisk模块,如果兼容的话,还会用overlayfs实现吗?
  2. 如果不打算兼容,内核卸载还会支持吗?

@tiann
Copy link
Owner

tiann commented Nov 14, 2025

感觉似乎没有什么必要,他如果想撤销,可以直接重新安装

模块在重新安装时安装脚本还是会执行一遍,可能会更新配置什么之类的。模块是下次启动后开始卸载的,一切在没发生前都来得及,是吗

你说的对,当前的 overlayfs 实现的确如此。但是我们计划实现 metamodule,将模块的 mount 能力释放给第三方实现,如果 metamodule 的 mount 用其他实现方式,可能直接当场就卸载,届时再实现 undo 就很麻烦了

关于metamodule,能问几个问题吗?

  1. 是否还会兼容magisk模块,如果兼容的话,还会用overlayfs实现吗?
  2. 如果不打算兼容,内核卸载还会支持吗?

兼容;只是把 mount 交给第三方,可以用 overlayfs,也可以用 bind mount;

@tiann
Copy link
Owner

tiann commented Nov 17, 2025

我们已经合并 #2929,当前情况下,卸载模块仅仅是放置一个 flag 到模块目录;因此依然可以支持撤销操作,如果你有兴趣,可以在此基础上添加,谢谢!

@u9521 u9521 force-pushed the undo-uninstall-module branch from 9448977 to dfd7ecb Compare November 18, 2025 02:37
@u9521
Copy link
Contributor Author

u9521 commented Nov 18, 2025

我们已经合并 #2929,当前情况下,卸载模块仅仅是放置一个 flag 到模块目录;因此依然可以支持撤销操作,如果你有兴趣,可以在此基础上添加,谢谢!

已更新

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@u9521 u9521 force-pushed the undo-uninstall-module branch from dfd7ecb to e9a9983 Compare November 18, 2025 04:13
@u9521
Copy link
Contributor Author

u9521 commented Nov 18, 2025

改了一下逻辑,和模块启用/禁用和卸载一样,反复撤销不再报错而是直接跳过

@u9521 u9521 force-pushed the undo-uninstall-module branch from e9a9983 to e5ad83e Compare November 19, 2025 01:31
@u9521 u9521 force-pushed the undo-uninstall-module branch from 75458b4 to ea80b4c Compare November 19, 2025 02:48
- 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 <[email protected]>
@tiann tiann merged commit 7f0bc41 into tiann:main Nov 19, 2025
17 checks passed
@u9521 u9521 deleted the undo-uninstall-module branch November 19, 2025 06:10
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 4, 2026
模块在卸载后,重启前可以在管理器中撤销本次卸载操作
命令如下

```shell
ksud module undo-uninstall <id>
```

---------

Co-authored-by: weishu <[email protected]>
Signed-off-by: u9521 <[email protected]>
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
模块在卸载后,重启前可以在管理器中撤销本次卸载操作
命令如下

```shell
ksud module undo-uninstall <id>
```

---------

Co-authored-by: weishu <[email protected]>
Signed-off-by: u9521 <[email protected]>
u9521 added a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
模块在卸载后,重启前可以在管理器中撤销本次卸载操作
命令如下

```shell
ksud module undo-uninstall <id>
```

---------

Co-authored-by: weishu <[email protected]>
Signed-off-by: u9521 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants