${prefix} as a disk-image (was: #49559: nepomuk-core can't be installed on a case-sensitive system)

René J.V. Bertin rjvbertin at gmail.com
Sat Oct 1 13:33:08 PDT 2016


On Friday September 30 2016 10:10:40 Lawrence Velázquez wrote:

I coined this admittedly a bit wild idea the other day that all of ${prefix} could be hosted on a R/W dynamic disk image, aka a sparse image or sparse bundle. That would make it possible to install the more "unixy" ports to a case-sensitive filesystem without need for guiding the user through the steps required to create a case-sensitive volume. It would also provide an alternative to those of us who want to use the default /opt/local prefix but still install MacPorts on a different volume. Rather than replacing /opt/local with a symlink after the initial install, we'd simply give the desired location for the image, and keep /opt/local as its mount point.

I also like the idea of being able to take the whole MacPorts tree offline with a simple command. 

I do something comparable with my "LinuxPorts" adaptation; it resides on a series of nested ZFS datasets.

> >> This sound convoluted. Also remember that MacPorts is not confined to
> >> installing files in ${prefix}. 
> > 
> > A tad, maybe. Anything that gets installed outside of ${prefix} is
> > largely out of control, but it's probably also safe to say that those
> > files are where they are because they're somehow specific to the OS
> > and thus don't make assumptions about filename case. 

Creation:
%> hdiutil create -type [SPARSE|SPARSEBUNDLE] -imagekey sparse-band-size=16384 -fs JHFS+X -layout NONE -volname MacPorts -uid 0 -gid 0 -o ${imgFileName}

Mount:
%> hdiutil attach ${imgFileName} [-kernel] -mountpoint ${prefix} -nobrowse -owners on -noautoopen

-kernel may or may not have advantages (no helper process) but only works with SPARSE (UDSP), not SPARSEBUNDLES. Contrary to what I expected, a SPARSEBUNDLE isn't slower than a sparse image, on the contrary even *). It also has the advantage that it can be compressed with afsctool, periodically (and when unmounted, evidently).

The attach command can be put in a "RunAtLoad" launchd plist in /Library/LaunchAgents, to avoid having to mess with /etc/fstab .

*) In fact, the XBench-1.3 disk-only score was about 2x on mounted the sparse bundle than on the volume hosting the bundle. Go figure ...


More information about the macports-dev mailing list