开发者

Is it possible to have a makefile step in a host OS execute a shell command inside a guest OS running in a VM?

开发者 https://www.devze.com 2023-03-06 08:22 出处:网络
I\'m currently developing apps for the inPulse watch (if you\'re a geek, check out www.GetInPulse.com) and am compiling for the watch while on a Mac.But deploying the app to the device takes several m

I'm currently developing apps for the inPulse watch (if you're a geek, check out www.GetInPulse.com) and am compiling for the watch while on a Mac. But deploying the app to the device takes several minutes. They do however offer a simulator, but that only runs under Linux so I installed Ubuntu in a VM, which works great.

What I'm hoping is to stay completely on the Mac side, except be able to execute a build step or shell script that can 'call into' the VM and launch a shell script there which kicks up the simulator. That way I can just add 'sim' as a step in my makefile back on the 'mac' side.

Currently, I'm mousing back and forth too damn much and I have terminals open all over th开发者_StackOverflow中文版e place in both the host and the guest OSes. Just trying to clean that up and cross-machine scripting seems like it would work in theory. Just don't know if the boundaries of cross-machines are even a valid thing.


The host OS doesn't know what a “shell” is inside the guest. A shell is an OS-dependent concept, and while the host OS technically knows everything that's going on in the guest, its only contact is by observing the guest memory and the instructions it runs, altogether the wrong level of abstraction here.

The most natural way to run shell commands from one OS to another is to use a remote shell facility over a network link; in practice, that means SSH. You need a network link between the two machines, and once you have that, it doesn't matter that one is a VM running inside the other. There probably is a network link already between the two machines; in case there isn't, make sure you activate a bridged network or a host-only network or whatever your VM technology offers.

Install an SSH client on the host (there's probably one already) and an SSH server on the guest (openssh-server Install openssh-server http://bit.ly/software-small). Then set up public-key authentication between the two machines so you don't need to type a password all the time.

You'll get shell access on the guest. If you need to manipulate GUI applications, you'll need to work a little more than that. ssh DISPLAY variable may help, or perhaps How can I run Firefox on Linux headlessly (i.e. without requiring libgtk-x11-2.0.so.0)?.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号