Open probonopd opened 2 years ago
Make .dmg
files mountable by double-click, like we do already for .iso
and .img
.
To make this happen using automount
, we would need to:
.dmg
files recognized with a MIME type that makes sense (file --mime-type Firefox\ 106.0.dmg
currently gives Firefox 106.0.dmg: application/x-bzip2
)/usr/local/share/applications/mount_md.desktop
, so that this is reflected in /usr/local/share/applications/mimeinfo.cache
launch "Mount Disk Image" /tmp/darling-dmg/build/Firefox\ 106.0.dmg
to be executed which in turn will create something like /dev/md1
automount
should inspect /dev/md1
, recognize that it is a dmg, and mount it using darling-dmg
. Looking at strings /dev/md1 | more
we see BZh91AY
which appears to be a bz2 headerBut apparently this is not how darling-dmg
works, as it seems to work only on files and not on mdX
devices:
FreeBSD% ./darling-dmg /dev/md1 /mnt
Error: Unsupported file format
Possible reasons:
1) The file is corrupt.
2) The file is not really a DMG file, although it resembles one.
3) There is a bug in darling-dmg.
The question is, does automount
(intend to) use FUSE filesystems like darling-dmg
? And if the answer is "yes", can it operate on the file directly rather than a /dev/mdX
device`?
Possibly we should handle .dmg
files more akin to .zip
and other archives:
/usr/local/share/applications/mountarchive.desktop
mountarchive %f
mountarchive
is a PyQt5 script that uses fuse-archive
to do the mounting without involving /dev/mdX
. (We could probably extend it to use darling-dmg
for .dmg
files.)However, in the case of a zip file, there is no icon shown on the desktop for the mounted file. Instead, double-clicking the file opens a Filer window at the mountpoint directly.
In the case of .dmg
and similar "image" files (as opposed to "archive" files), it is questionable whether this is desired. For .iso
and .img
, double-clicking those doesn't directly open a window that shows their contents, but they are mounted and shown on the desktop instead (like on the Mac). It is probably debatable whether the distinction between "archive" and "image" files is still relevant today and is understood by users; especially if we are technically treating "archive" files just like "image" files, namely, by mounting them.
We should align with @vermaden on whether he wants this kind of functionality (double-click on a .zip
or .dmg
or any other type of file that can be mounted using FUSE to get it automounted) in automount
or not. If not, then the way we are currently doing it for .zip
is perfectly fine for helloSystem.
It is probably debatable whether the distinction between "archive" and "image" files is still relevant today and is understood by users; especially if we are technically treating "archive" files just like "image" files, namely, by mounting them.
Well, one "image" file can have multiple partitions (a.k.a. "volumes"); that's probably why double-clicking "image" files just mounts the volumes in those instead of opening a winow with their contents directly?
But then, darling-dmg
(and macOS) only mount the main partition in .dmg
files anyway...
it seems to work only on files and not on mdX devices
Maybe we'd need to throw in fuseblk
in there somehow; this seems to be the magic keyword at least on Linux for FUSE to work with block devices rather than with files.
If we even want to go down that path.
Hi,
do you need anything from my side in this?
Regards.
Hi @vermaden, just wanted to know whether mounting things like Mac .dmg
disk image files with FUSE is in the scope of automount
. Thanks!
The automount(8) acts against devices - if we use md(4) to map that *.DMG to /dev/md* device then I have nothing against it.
Description of the file format: http://newosxbook.com/DMG.html
commands such as "file" have a hard time identifying the DMG file type: In the absence of a fixed header, a DMG can start with any type of data (disk or partition headers), which can be further compressed by myriad means
In fact, there is no "header" but a "footer":
FreeBSD% tail -b 1 Downloads/Transmission-3.00.dmg | head -c 4 | strings
koly
If this returns koly
, then it is a dmg.
Now, does the tail
command even work on md(4) devices?
This is the way.
% mdconfig.sh -l
md0 vnode 5564K /home/vermaden/Transmission-3.00.dmg
% SECTORS=$( diskinfo -v /dev/md0|awk '/mediasize in sectors/ {print $1}' )
% echo ${SECTORS}
11127
% SECTORSIZE=$( diskinfo -v /dev/md0 | awk '/sectorsize/ {print $1}' )
% echo ${SECTORSIZE}
512
% dd if=/dev/md0 skip=$(( ${SECTORS} - 1 )) bs=${SECTORSIZE} 2> /dev/null| strings | tail -1
koly
Wow. But can you get mdX
to mount with darling-dmg
? It works for me on files but not on mdX
devices...
No such package:
% pkg search darling
%
Then please let me know when that 'soon' happens :)
FUSE module for .dmg files (containing an HFS+ filesystem)
Periodic reminder that I still has it in my TODO list :)
Not possible with RAW devices:
Works with file:
% darling-dmg download/transmission-4.0.3.dmg /media/tmp
Skipping partition of type Primary GPT Header
Skipping partition of type Primary GPT Table
Skipping partition of type Apple_Free
Using partition #3 of type Apple_HFS
Everything looks OK, disk mounted
Does not work when device created from that file:
% mdconfig.sh -l
md0 vnode 7361K /data/download/transmission-4.0.3.dmg
% darling-dmg /dev/md0 /media/tmp
Error: Unsupported file format
Possible reasons:
1) The file is corrupt.
2) The file is not really a DMG file, although it resembles one.
3) There is a bug in darling-dmg.
Sorry.
A
.dmg
mounter (...) can be implemented usingdarling-dmg
(tested; known to work).References: