github.com/mutagen-io/mutagen@v0.18.0-rc1/scripts/ci/setup_partitions_darwin.sh (about)

     1  #!/bin/bash
     2  
     3  # Exit immediately on failure.
     4  set -e
     5  
     6  # TODO: We can actually specify the mount points for these images as part of the
     7  # "hdiutil attach" command, so we don't need to rely on their volume names and
     8  # assumptions about them being mounted in /Volumes. We might want to generate a
     9  # specific testing directory at which to mount these.
    10  
    11  # TODO: Write a corresponding script to unmount these volumes. It's not critical
    12  # for CI testing, but it would be nice to have for local testing.
    13  
    14  # Create and mount a FAT32 partition.
    15  # NOTE: There seems to be a lower bound on the size here, though I haven't
    16  # probed around enough to see what it is (20 MB is too small), and I'm not sure
    17  # if it applies to the other filesystems. Also, FAT32 has serious volume name
    18  # length limitations and hdiutil won't notify you if the name is too long - it
    19  # will just use "NO NAME" for the volume name and you'll be surprised when it
    20  # doesn't mount where you expect, so it's best to test the volume name you want
    21  # manually before scripting it.
    22  hdiutil create -megabytes 50 -fs "MS-DOS FAT32" -volname FAT32ROOT -o fat32image.dmg
    23  hdiutil attach fat32image.dmg
    24  
    25  # Create and mount an HFS+ parition.
    26  hdiutil create -megabytes 50 -fs "HFS+" -volname "HFSRoot" -o hfsimage.dmg
    27  hdiutil attach hfsimage.dmg
    28  
    29  # Create and mount an APFS partition.
    30  hdiutil create -megabytes 50 -fs "APFS" -volname "APFSRoot" -o apfsimage.dmg
    31  hdiutil attach apfsimage.dmg
    32  
    33  # Create and mount an additional HFS+ partition inside the APFS partition to
    34  # test filesystem boundary crossing.
    35  hdiutil create -megabytes 50 -fs "HFS+" -volname "HFSSub" -o hfssubimage.dmg
    36  hdiutil attach -mountpoint "/Volumes/APFSRoot/HFSSub" hfssubimage.dmg