Skip to content

Consider adding a loopmount script #34

@probonopd

Description

@probonopd

Let's make loop-mouning filesystem images (like ISO files and hard disk images) easier.

Consider adding a loopmount script that would allow all filesystems in a given image file to be mounted with automount.

Something along these lines:

IMAGE="${1}"

if [ ! -f "${IMAGE}" ] ; then
  echo "${IMAGE} does not exist"
  exit 1
fi

md=$(sudo -A -E mdconfig -a -t vnode -o readonly -f "${IMAGE}")
# DEVICES=
for DEVICE in $(ls "/dev/${md}" "/dev/${md}p"* "/dev/${md}s"* 2>/dev/null) ; do
  echo sudo -A -E /usr/local/sbin/automount $(echo "${DEVICE}" | sed -e 's|/dev/||g') attach
  sudo -A -E /usr/local/sbin/automount $(echo "${DEVICE}" | sed -e 's|/dev/||g') attach
done

# TODO: Sleep until all partitions have been unmounted, then
# mdconfig -d -u ${md}

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions