]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[settings] Expose current working URI and directory URI via settings
authorMichael Brown <mcb30@ipxe.org>
Tue, 19 Mar 2024 13:22:57 +0000 (13:22 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 19 Mar 2024 13:33:21 +0000 (13:33 +0000)
commit88c2a01e1aeb56335f893ac865d36f0fa843864c
treeb71a3e804134875bbc984a42e677221adfa70408
parent926816c58fca5641b17c17379b52203458081668
[settings] Expose current working URI and directory URI via settings

iPXE maintains a concept of a current working URI, which is used when
resolving relative URIs and allows scripts to download files using
URIs relative to the script itself.

There are situations in which it is valuable for a script to be able
to access the URI explicitly as a string, not just implicitly as a
base URI for subsequent downloads.  For example, when booting a Fedora
installer, the "inst.repo" command-line parameter may be used to pass
the URI of the repository to the installer.

Expose the current working URI as ${cwuri}.  Since relative URIs may
be constructed as strings only from a directory URI (not from a full
URI), also expose the current working directory URI as ${cwduri}.

This feature may be used as e.g.

  #!ipxe
  echo Booting from ${cwuri}
  prompt -k 0x197e -t 2000 Press F12 to install Fedora... || exit
  kernel images/pxeboot/vmlinux inst.repo=${cwduri}
  initrd images/pxeboot/initrd.img
  boot

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/core/settings.c
src/tests/uri_test.c