ksud: fix some module scripts won't add KSU_MODULE environment var#3445
Open
AlexLiuDev233 wants to merge 1 commit intotiann:mainfrom
Open
ksud: fix some module scripts won't add KSU_MODULE environment var#3445AlexLiuDev233 wants to merge 1 commit intotiann:mainfrom
AlexLiuDev233 wants to merge 1 commit intotiann:mainfrom
Conversation
KSU_MODULE environment var will only pass in exec_script, that's cause only stage-scripts, action.sh and uninstall scripts have this environment var So, it cause customize.sh, and meta*.sh won't have this envionment var And module developers will see them can't use ksud module config set command, because ksud throw This command must be run in the context of a module or passed --internal <name> Signed-off-by: AlexLiuDev233 <wzylin11@outlook.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates ksud’s script execution environment handling so module-related scripts consistently receive the KSU_MODULE environment variable (not just scripts launched through exec_script), enabling module scripts like customize.sh / meta*.sh to use module-scoped commands (e.g., module config operations) without requiring --internal.
Changes:
- Refactors
get_common_script_envs()to accept an optionalmodule_idand injectKSU_MODULEwhen available/valid. - Ensures installer execution (
exec_install_script) propagatesKSU_MODULEby passing the installing module’s id into the common env set. - Updates metamodule script execution to pass a metamodule id into the common env set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| userspace/ksud/src/module.rs | Refactors common script env generation to optionally include KSU_MODULE, and wires it into install script execution and exec_script(). |
| userspace/ksud/src/metamodule.rs | Adds metamodule id helper and passes an id into common envs for metamodule-run scripts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KSU_MODULE environment var will only pass in exec_script, that's cause only stage-scripts, action.sh and uninstall scripts have this environment var
So, it cause customize.sh, and meta*.sh won't have this envionment var
And module developers will see them can't use ksud module config set command,
because ksud throw
This command must be run in the context of a module or passed --internal <name>Taking the magic_mount_rs module as an example:
before:
after: