It would be useful [0] to have a MIME type for identifying raw disk images. By their very nature we can't sniff anything so we have to rely on things like file extensions to identify them. Proposing to use the extensions .raw-disk-image (because being precise is good and verbosity isn't a big factor here) and .img (because it's already used for disk images). [0] : obvious use case: OS vendor provides a web app where users pick the OS to download. In the end the browser returns the file VendorOS-V42-x86_64.raw-disk-image. Once downloaded the web browser then launches the "Disk Image Copier" application (after user confirmation etc) which, when launched, assists the user in picking the device the image should be written to
Created attachment 79634 [details] [review] Patch Here's a patch that does this. Thanks for considering.
Btw, I've already implemented most of the functionality in Disks for this: https://git.gnome.org/browse/gnome-disk-utility/commit/?id=55ceb75042cb22a041847278aa3aaec9d044b729 With this MIME type, all I really need to add to Disks is a .desktop file with something along these lines _Name=Disk Image Copier Exec=gnome-disks --restore-disk-image %U Icon=drive-removable-media MimeType=application/x-cd-image;application/x-raw-disk-image;
Comment on attachment 79634 [details] [review] Patch The original patch is now obsolete as we also want to support compressed disk images. The changes I'd like to see are these https://git.gnome.org/browse/gnome-disk-utility/tree/data/gdu-mimetypes.xml If you think this is a good idea, I'll prepare a patch post-haste. Thanks!
Comment on attachment 79634 [details] [review] Patch Review of attachment 79634 [details] [review]: ----------------------------------------------------------------- ::: freedesktop.org.xml.in @@ +1475,5 @@ > <glob pattern="*.dmg"/> > </mime-type> > + <mime-type type="application/x-raw-disk-image"> > + <_comment>raw disk image</_comment> > + <glob pattern="*.img"/> Could that be a parent of the application/x-cd-image mime-type? Can we have test cases for this? And can you please update the git-formatted patch with your latest g-d-u changes? Please see the HACKING file for details about the test suite.
(In reply to comment #4) > Comment on attachment 79634 [details] [review] [review] > Patch > > Review of attachment 79634 [details] [review] [review]: > ----------------------------------------------------------------- > > ::: freedesktop.org.xml.in > @@ +1475,5 @@ > > <glob pattern="*.dmg"/> > > </mime-type> > > + <mime-type type="application/x-raw-disk-image"> > > + <_comment>raw disk image</_comment> > > + <glob pattern="*.img"/> > > Could that be a parent of the application/x-cd-image mime-type? What are the implications of doing this? IOW, what will it break. > Can we have test cases for this? > > And can you please update the git-formatted patch with your latest g-d-u > changes? > > Please see the HACKING file for details about the test suite. Will do.
(In reply to comment #5) > (In reply to comment #4) > > Comment on attachment 79634 [details] [review] [review] [review] > > Patch > > > > Review of attachment 79634 [details] [review] [review] [review]: > > ----------------------------------------------------------------- > > > > ::: freedesktop.org.xml.in > > @@ +1475,5 @@ > > > <glob pattern="*.dmg"/> > > > </mime-type> > > > + <mime-type type="application/x-raw-disk-image"> > > > + <_comment>raw disk image</_comment> > > > + <glob pattern="*.img"/> > > > > Could that be a parent of the application/x-cd-image mime-type? > > What are the implications of doing this? IOW, what will it break. Nothing should break. It means that g-d-u would show ISO images as being something you can dd to a USB disk as well for example, but still having a separate description. > > Can we have test cases for this? > > > > And can you please update the git-formatted patch with your latest g-d-u > > changes? > > > > Please see the HACKING file for details about the test suite. > > Will do. Note that the generic icon name is wrong. There's a small list of icons at the top of the freedesktop.org.xml.in file that are allowed. Icon themes should gracefully fallback if they can't find an exactly matching icon. Install xmllint and run "make check" (as part of the test suite as well), it should show the errors.
Sorry for the delay, my Fedora box stopped working and I've only just got hold of another one. (In reply to comment #6) > (In reply to comment #5) > > (In reply to comment #4) > > > Comment on attachment 79634 [details] [review] [review] [review] [review] > > > Patch > > > > > > Review of attachment 79634 [details] [review] [review] [review] [review]: > > > ----------------------------------------------------------------- > > > > > > ::: freedesktop.org.xml.in > > > @@ +1475,5 @@ > > > > <glob pattern="*.dmg"/> > > > > </mime-type> > > > > + <mime-type type="application/x-raw-disk-image"> > > > > + <_comment>raw disk image</_comment> > > > > + <glob pattern="*.img"/> > > > > > > Could that be a parent of the application/x-cd-image mime-type? > > > > What are the implications of doing this? IOW, what will it break. > > Nothing should break. It means that g-d-u would show ISO images as being > something you can dd to a USB disk as well for example, but still having a > separate description. Done. > > > > Can we have test cases for this? > > > > > > And can you please update the git-formatted patch with your latest g-d-u > > > changes? > > > > > > Please see the HACKING file for details about the test suite. > > > > Will do. Done. > Note that the generic icon name is wrong. There's a small list of icons at > the top of the freedesktop.org.xml.in file that are allowed. Icon themes > should gracefully fallback if they can't find an exactly matching icon. OK. I'v removed the <generic-icon> tags. Will file a bug against gnome-icon-theme for the icon association (just like for application/x-cd-image). > Install xmllint and run "make check" (as part of the test suite as well), it > should show the errors. Done.
Created attachment 83054 [details] [review] Updated patch Here's an updated patch with the changes you requested. Please take another look! Thanks and Cheers!
Created attachment 83057 [details] [review] Patch v3 Sorry, I uploaded the wrong patch file missing the third file in the added lines in tests/list. The test suite passes with this one.
Thanks for the patch! commit 33bce05a5fed6ca8d85ff4c7e0205c9a1ed32e25 Author: David Zeuthen <zeuthen@gmail.com> Date: Fri Jul 26 12:51:17 2013 -0700 Add MIME types for raw disk images https://bugs.freedesktop.org/show_bug.cgi?id=64845
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.