Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

muvm-guest: Support root and user init scripts #87

Closed
wants to merge 1 commit into from

Conversation

asahilina
Copy link
Member

Introduce two scripts that can be placed in ~/.local/share/muvm

  • init.sh: Executed as root, before dropping privileges
  • user.sh: Executed as the user, after dropping privileges

If the files are also present in lower-priority XDG dirs (systemwide), those are executed first.

This makes it possible to add custom VM configuration and setup or debugging scripts without having to hack on the muvm code.

Introduce two scripts that can be placed in ~/.local/share/muvm

- init.sh: Executed as root, before dropping privileges
- user.sh: Executed as the user, after dropping privileges

If the files are also present in lower-priority XDG dirs (systemwide),
those are executed first.

This makes it possible to add custom VM configuration and setup or
debugging scripts without having to hack on the muvm code.

Signed-off-by: Asahi Lina <[email protected]>
// See https://doc.rust-lang.org/std/env/fn.set_var.html#safety
env::set_var("HOME", user.dir);
let xdg_dirs = xdg::BaseDirectories::with_prefix("muvm")?;
// SAFETY: Safe if and only if `muvm-guest` program is not multithreaded.
Copy link
Member

Choose a reason for hiding this comment

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

cc @slp for #64 interaction

@slp
Copy link
Collaborator

slp commented Oct 16, 2024

I think I understand the motivation, but I'm afraid this may open the floods to users implementing all shorts of hacks behind muvm-guest's back. If it's intended just for developing purposes, the role of user.sh could be achieved by calling it as the first program in the guest, and for the role of root.sh, #89 will allow launching programs as root in the guest (and, combined with #48, it'll also be possible to have a root shell).

Beyond developing purposes, I think the configuration to the VM should be applied by muvm-guest itself.

@asahilina
Copy link
Member Author

Closing in favor of #89

@asahilina asahilina closed this Oct 26, 2024
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.

3 participants