Code Monkey home page Code Monkey logo

Comments (9)

david-guenault avatar david-guenault commented on September 24, 2024 4

Wow that was fast :-) thx a lot

from packer-plugin-tart.

n8felton avatar n8felton commented on September 24, 2024 1

It may, I'll have to see how it is implemented. My goal is to be able to access things from inside RecoveryOS, so if it can work in RecoveryOS as well as in a fully booted macOS, I'm all for it.

(I'm also investigating implementing the HTTP server, if you think you'd accept a PR for it.)

from packer-plugin-tart.

timsutton avatar timsutton commented on September 24, 2024 1

I made some work-in-progress on serving from http_directory config in a branch here: https://github.com/timsutton/packer-plugin-tart/tree/http-server

The main thing it's missing is implementing the automatic detection of the host IP. We could start with NAT and take its gateway IP that is set on the bridge100 interface. But ideally it should work with other network config modes as well (and not sure whether softnet would need special handling, since I haven't yet used that networking mode).

There might also be a better/safer way than the above, but I just haven't spent enough time looking at possible options for this. I'll continue experimenting there.

from packer-plugin-tart.

n8felton avatar n8felton commented on September 24, 2024

Notes for possibly helping to implement this:

https://github.com/hashicorp/packer-plugin-vsphere/blob/main/builder/vsphere/iso/builder.go#L97
https://github.com/hashicorp/packer-plugin-sdk/blob/main/multistep/commonsteps/step_http_server.go

from packer-plugin-tart.

fkorotkov avatar fkorotkov commented on September 24, 2024

Will #15 work for you? We were planning to look into it in the coming weeks to simplify installation of Xcode so we don't need to download it every time.

from packer-plugin-tart.

fkorotkov avatar fkorotkov commented on September 24, 2024

Of course we'll review the PR! And we'll happily accept it. 👌

from packer-plugin-tart.

n8felton avatar n8felton commented on September 24, 2024

I'm hoping to find more time this week to continue hacking away at this, but in case others get to it before I do, I was able to get the step_wait_for_ip and step_http_ip_discover steps cloned over and working fairly easily with minimal changes.

In step_wait_for_ip I added the function

func WaitForIP(vmName string, waitTime string) (string, error) {
	return TartExec("ip", "--wait", waitTime, vmName)
}

and replaced this line to use the new function.

In build.go, I have this hacked together for now for testing

	steps = append(steps,
		new(stepSetVM),
		new(stepDiskFilePrepare),
		new(stepRun),
		commonsteps.HTTPServerFromHTTPConfig(&b.config.HTTPConfig),
		&StepHTTPIPDiscover{
			HTTPIP:  b.config.BootConfig.HTTPIP,
			Network: b.config.WaitIpConfig.GetIPNet(),
		},
	)

Edit: I just remembered that we mostly only care about the host IP for the HTTP server, so probably only the step_http_ip_discover stuff is really relevant. Leave the other notes here anyway.

from packer-plugin-tart.

timsutton avatar timsutton commented on September 24, 2024

Yeah, we just want to obtain it on the host.

I borrowed the ifconfig-parsing code from packer-plugin-vmware, and while this worked, it is a step that needs to happen after the VM has started (and return an IP before the boot_command is typed), because only then can we expect to have the bridge100 interface exist. It takes about 6-8 seconds to show up after a VM has been started.

It could be added into stepRun so that it's insertable within the flow of things that happen in that step, but I wonder if it'd make sense to start breaking up that step into more steps, similar to the vmware builder. I haven't tried that yet so it would increase the scope of a PR somewhat.

I think some other builders have precedents of being able to obtain the host IP before the VM is started, because something like vmware-natd is already running as a background daemon managing NAT leases for a persistent gateway interface. With these Apple Silicon VMs I'm not sure there's a reliable way to look up the NAT gateway IP when no VM is running. (/var/db/dhcpd_leases is there but only used for clients, and it's what tart ip uses).

from packer-plugin-tart.

david-guenault avatar david-guenault commented on September 24, 2024

Do you have any news about this implementation ?
Thx.

from packer-plugin-tart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.