Closed AvrumFeldman closed 1 week ago
Why would we do that, is it better than using oscdimg?
BTW oscdimg is established official Microsoft tool so maybe still better choice since it is battle tested. We would still rely on other external binary dependancies (bsdtar, qemu-img) so this would not help us remove externals dependencies.
If you would like to merge this please make PR with following
New-IsoFile.ps1
Hi @schtritoff
Your repo helped me out so I was just trying to reciprocate in kind.
I know oscdimg is an established and official tool to create images, I personally like to avoid shipping binaries with Powershell scripts since they add an external (avoidable) dependency, I figured you might also like to reduce an external dependency, I agree this doesn't remove all external dependencies, but every dependency less imho is better.
This above code relies on the build in windows imapi2 API which is a native windows API to create ISOs so it's not some complete homebrew code.
I specifically didn't create a PR since I don't have the time for this, but I still wanted to be helpful so I offered the code as is for you or anyone else to be able to make a PR.
Feel free to close this issue as is 😀
Thanks again for your amazing tool.
It makes sense from a license perspective to switch. There is a simpler powershell solution based on the former script here: https://github.com/TheDotSource/New-ISOFile. I am testing it and will likely make a PR soon.
Hi @schtritoff
Your repo helped me out so I was just trying to reciprocate in kind.
I know oscdimg is an established and official tool to create images, I personally like to avoid shipping binaries with Powershell scripts since they add an external (avoidable) dependency, I figured you might also like to reduce an external dependency, I agree this doesn't remove all external dependencies, but every dependency less imho is better.
This above code relies on the build in windows imapi2 API which is a native windows API to create ISOs so it's not some complete homebrew code.
I specifically didn't create a PR since I don't have the time for this, but I still wanted to be helpful so I offered the code as is for you or anyone else to be able to make a PR.
Feel free to close this issue as is 😀
Thanks again for your amazing tool.
Please try out the draft of the pull request
Using isoinfo is a good way to check if the iso matches the specification of cloud-image:
This is the isoinfo from the Microsoft generated one:
10:36 $ isoinfo -d -i ubuntu-demo-metadata.iso CD-ROM is in ISO 9660 format System id: Volume id: CIDATA Volume set id: CIDATA Publisher id: MICROSOFT CORPORATION Data preparer id: MICROSOFT CORPORATION, ONE MICROSOFT WAY, REDMOND WA 98052, (425) 882-8080 Application id: OSCDIMG 2.56 (01/01/2005 TM) Copyright File id: Abstract File id: Bibliographic File id: Volume set size is: 1 Volume set sequence number is: 1 Logical block size is: 2048 Volume size is: 25 NO Joliet present NO Rock Ridge present
The above code does not create an image which matches this for now.
I add an alternative iso creation with mkisofs.
thanks @AvrumFeldman for the hints, implemented in 01bae57
For reference - if for some reason we would need better support for ISO generation - for example to make it cross platform - DiscUtils library would be a good candidate https://www.nuget.org/packages/LTRData.DiscUtils.Containers/
can confirm it works. Had a network issue on my side before. Thanks.
I'm sorry that I'm doing this as an issue instead of a PR I'm just too lazy for a full PR but I still want to give this (hopefully) helpful code.
The below code creates an ISO completely in PowerShell, without relying on external software dependencies. I found this a while back floating around on the internet, and crudely modified it to make it work for cloud-init, you might appreciate to use this instead of relying on oscdimg.
I did some changes to common version floating around, namely I hardcoded in that the ISO should specifically use the ISO9660 filesystem and not UDF as per the documentation this is required. The actual changes are
$image.FileSystemsToCreate = 3
(link) and$Image.GetDefaultFileSystemForImport(1)
(link) I did some other minor changes but those most probably aren't really needed.