I actually made some progress on this front. It became a bit more clear when I thought it over and made some considerations.
My setup is such that I have mirrored (via rsync) local repos of CentOS and Fedora. I then symlink the ISO’s within those repos to another place to make them easy for people to download the ISO. In this scenario I don’t have to do anything with the ISO to get the installation files need by PXE as they are available in the repo as I have syncd them.
With the above in mind, I should be able to accomplish the same for any Linux distro that I can mirror/rsync locally which nullifies the needs/goals of my OP.
I then thought about what OS’s this need actually applied to, and in my case it came down to Windows 10 and ESXi (various versions). I don’t mind downloading the ISO manually. What I was looking to accomplish was being able to take an iso or a batch of them in a dir and identify their; OS, version, build, revision and be able to use that to create a unique directory structure for said iso and then dumb the iso contents into the created dir structure for it.
The part I was hung up on was how to get the information I needed for this and that part, at least for Windows 10 (really any Windows ISO) and ESXi I have figured out at least as a proof of concept. I realized that the iso file name would not be the most reliable method of doing so and found ways unique to each OS family to identify the metadata I needed.
ESXi (having checked multiple Dell isos from 6.5-6.7):
I found that they had a /upgrade
folder with 2 note worthy files in them. metadata.xml
contains the version number and build number. profile.xml
has the full name (so even if the file name of the iso is changed this should stay the same) from which I could extract things like the Dell revision and U1/U2 monikers used for Update 1 and Update 2, etc. It also has a tag for “creator” so I should be able to differentiate between Dell isos and non-dell isos.
To parse out the xml I found that xmllint
provided by libxml2
would allow me to reliably pull this info from the xml files. Coincidentally, libxml2
was needed by wimlib anyhow (mentioned below for Windows).
Windows 10:
I installed wimlib
and using the wiminfo
command on the install.wim (combined with grep) I am able to pull information about the ISO as well as deduce if the ISO is a Windows ISO. I can get name, version, build number in this fashion.
I may expand this to Server 2016/2019 if they start releasing new iso builds “frequently” like they do with Windows 10, but older versions the iso hasnt changed for a long time and I have these setup already.
So basically it comes down to checking the ISO’s for the structure/files that match the OS family. In this case /upgrade/metadata.xml
being ESXi and /sources/install.wim
being Windows. Then I either parse out the XML for ESXi or using wiminfo pull the info from the wim file for Windows.
After that should be “easy”. Create a path using that info, check if it already exists, dump the iso contents, unmount, etc. I am also considering putting a fail safe kind of option in so that if the ISO doesnt match any conditions I am checking to “classify” it, I can prompt the user for manual input if they want to process the ISO allowing them to determine the path to dump it into.
Follow Up Question:
I hadnt considered it before, but generally speaking I assume it would be possible via the bash script to also update or add to the FOG’s iPXE menu by manipulating the “config” file that stores the menu? Or is there a database in between that would make that problematic?
I am not stuck on automating the menu creation but if its a relatively simple addition might as well add it.
Conclusion:
Once I get this written up into a moderately working fashion I intend to post it on my Github and would be happy to share the link back here.
Thanks