The v1compat CLI is now complete, with support for --debug. The v2 CLI
additionally supports optional timestamping, so that when you're using
a modern init system that captures logs for you (e.g. systemd), you
don't have stuttering timestamps.
This allows API servers to return URL(x) in the cmdline template,
which pixiecore translates to an appropriate ID(x) template call
to get the file proxied via Pixiecore.
The main difficulty in passing a commandline as a plain string is
that you sometimes want to encode IDs into it, to tell your kernel
to fetch something via Pixiecore. Solving that problem with maps is
a bit clunky. Instead, now we use a text/template {{ ID "foo" }} to
mean "make a URL that, when fetched, reads the file "foo" from the
Booter.
I'm deliberately *not* checking in the vendor/ directory here, because
doing so would interfere with people trying to use the libraries rather
than the binaries. Sadly, none of the vendoring tools work very well when
I ask them to vendorize just cmd/ (they reimport a copy of the libs in
this repository), so for simplicity right now I'll lock the versions with
glide, but users wanting reproducible builds will still need to
`glide install` themselves.
iPXE has an annoying race condition where it sometimes doesn't notice
the ProxyDHCP response when booting, and fails. So we embed a boot
script in the builtin iPXE binaries that implements the retry loop
recommended in the documentation. Empirically, this has resolved
flaky boots on my test machine, usually no more than a single
retry is needed.
This hack tries to interpret the commandline based on what Pixiecore v1
did, before handing off to the fancier v2 CLI logic.
Doesn't support API mode yet, since that's not yet implemented in
the library.
These flags are both for providing binaries when running the apache2
version of pixiecore (which doesn't have builtin ipxe), and for
overriding the builtin version if desired.
The cli package is meant for single-shot execution anyway, so
instead of plumbing everything through reentrantly, let's just
have a global you can seed before calling CLI().
The two binaries (Apache2 and GPL) both invoke the cli package to do
the work, the only difference between them is that the GPL binary passes
it embedded ipxe binaries.
In practice, most people will want the standalone binary that Just
Works, the variant that doesn't embed ipxe is going to be for niche
applications only.
As it turns out, it's fairly difficult to do anything useful with DHCP
without this information, and the Conn implementations I can think of
all provide the information, so we might as well make it a requirement.
Also introduces a "Trace" member to the API, for the future addition of
extremely verbose and complete tracing, to be used for bug reports. But
for now, only Log is used.
This version is still *extremely* barebones, and the unstable tag
in the README applies triple for it, but the code in its current
state is capable of booting x86 and UEFI clients correctly, and
that was hard enough to merit a snapshot checkpoint.
It turns out many PXE firmwares request tsize to size the download
buffer, and will refuse to download at all if the server cannot
provide a tsize.
This unfortunately breaks API compatibility to add a size parameter,
but I think it's an unfortunate necessity to make this work.
Conn is supposed to accept "" to mean "listen for DHCP on all interfaces",
but portableConn didn't correctly handle that.
And I got the comparison wrong on ifidx in the portable send function, so
packets got sent out entirely the wrong interface :(.