-
-
Notifications
You must be signed in to change notification settings - Fork 43
Add init-command option #158
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
Conversation
|
I remember there was a mention somewhere of plans of having an init script automatically run... |
|
I was thinking whether you should be able to specify this option multiple times and came to the conclusion that if your setup has more than one step, you can just wrap it in a shell script as I did. Also, I was thinking about adding a short option and came up with |
Yeah, in the PR I mention 😄 |
The last one should win? EDIT: Or actually, what do you think about having an entrypoint script like Docker? |
|
That's the current behavior. I'm just thinking out loud whether that's the best UX... I don't mind how it is right now though, just throwing ideas around |
WDYM? I'm probably not well versed in Docker enough but from my understanding ENTRYPOINT is the command that's always executed, then comes CMD which is the "default" which you can then override |
|
Yeah, sorry, just thinking out loud. But I see now why that doesn't work as an init script... 😅 But do you think it'd make sense to have this be something that's automatically used by default, a la |
|
I think it does, though I've considered maybe instead of Definitely wouldn't be a part of this PR in particular, but would open the door to such options, if users would want them |
|
The name |
|
What about something like |
|
Semi-related: Why is the workdir being set to |
Oh yeah, I guess that's the reason why it doesn't stay in the current directory when you do e.g.
If the cwd is not in |
Yeah I know, I realized yesterday I implemented it wrong with |
Yeah... this is resolved by #157 anyway, but still workdir being |
9071268 to
96d10b5
Compare
|
I changed the option from |
07c1fb0 to
dc5ad75
Compare
|
Setting workdir to cwd can cause an issue where the first command is started from a removable mount, and it will then hold on to it and prevent unmounting, even if no process inside the vm is using that mount anymore. |
Would you prefer me implement resolving the command or pass in cwd as part of |
|
The second one feels more robust, imo |
|
Alternatively we could also only allow absolute paths and commands which are in PATH. I'm fine with any of those options |
|
I'll revert the |
dc5ad75 to
47a622a
Compare
|
Would you prefer the config file work to be started as part of this PR or should I do that in a follow up once this PR lands? Also despite the UX improvements #157 brings I'd like this PR to get in sooner since this resolves the biggest blocker when it comes to muvm on NixOS and makes it possible to properly package it :) |
|
Is this design in some way not accepted? It's been open without feedback for a few weeks now. If a maintainer didn't get to it yet that's understandable. Just wanting to know the state that's all. |
|
LGTM. @teohhanhui @WhatAmISupposedToPutHere WDYT? |
|
Should probably also add a way to specify it via configs in /etc or whatever, but all my issues were resolved. |
|
Ack, let's merge this one. @nrabulinski could you please do a rebase? |
Will do, I also started working on the muvm config. Do you want that to be a part of this PR too? Or should I make it part of a subsequent one |
Instead of reading $USER variable and finding the user based on that, use uid to lookup the user. Signed-off-by: Nikodem Rabuliński <[email protected]>
Signed-off-by: Nikodem Rabuliński <[email protected]>
Allows to execute a command before the guest server starts. Useful on distros like NixOS where we need additional mounts. Signed-off-by: Nikodem Rabuliński <[email protected]>
47a622a to
185ddd9
Compare
|
Rebased and added reading |
185ddd9 to
7a603be
Compare
|
Could you also add /usr/lib/muvm/config.json to config search path, for distro-provided configs? |
Muvm will first look in $XDG_CONFIG_DIR:-~/.config for a muvm/config.json file. Failing this, it will try reading /etc/muvm/config.json, and finally /usr/lib/muvm/config.json, to allow distributions to ship a default config file. Currently the configuration file only allows *prepending* execute_pre option. Specifying --execute-pre will not overwrite what's already in the config file. Signed-off-by: Nikodem Rabuliński <[email protected]>
7a603be to
012103e
Compare
|
Done. I also made it so that the list can be trivially extended in the future (though that most likely won't be needed) |
|
If we want to bikeshed some more I could also introduce something like |
slp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Closes #37, supersedes #38 while being more general
Allows to execute a command before the guest server starts.
Useful on distros like NixOS where we need additional mounts.
E.g. on NixOS this means I can use muvm from main with this patch by running
muvm --init-command=init.sh $SHELLwithinit.shbeing#!/bin/sh ln -s /run/muvm-host/run/opengl-driver /run/opengl-driver ln -s /run/muvm-host/run/current-system /run/current-systemwhereas currently it's not as straightforward