Do they belong to you? Claim these comments.
SolarisSmurf
Is this you? Claim Profile »
3 years ago
in Mount an ISO image on a Solaris filesystem with lofiadm | Solaris system administration | Tech-Recipes on Tech-Recipes
---------------- mount_iso ---------------------
#!/bin/sh
#
# Mount an ISO image using a loopback filesystem.
#
if [ -z "$1" -o -z "$2" ]; then
echo "$0 <full_path_to_iso> <mount_point>"
exit 0
fi
# Add the loopback block device.
# This will return the device path under /dev/lofi/.
printf "Creating loopback device to $1 ... "
LOFS_DEVICE=`lofiadm -a "$1"`
if [ 0 -ne $? ]; then
exit 1
else
echo "${LOFS_DEVICE}"
fi
# Now, mount the device to the mount point specified.
printf "Mounting $2 on ${LOFS_DEVICE} ... "
mount -F hsfs -o ro "${LOFS_DEVICE}" "$2"
if [ 0 -ne $? ]; then
lofiadm -d ${LOFS_DEVICE}
exit 1
else
echo "mounted"
fi
-------------------- umount_iso ---------------------------
#!/bin/sh
#
# Unmount an ISO image mounted over the loopback file system.
#
if [ -z "$1" ]; then
echo "$0 <mount_point>"
exit 0
fi
# Find the loopback device in the list of mount points.
LOFS_DEVICE=`mount | grep "$1" | awk '{print $3}'`
if [ -z "${LOFS_DEVICE}" ]; then
echo "Unable to find loopback device for mount point $1"
exit 1
fi
# Unmount the mount point.
printf "Unmounting $1 on ${LOFS_DEVICE} ... "
umount $1
if [ 0 -ne $? ]; then
exit 1
else
echo "unmounted"
fi
# Delete the loopback block device.
printf "Deleting loopback device ${LOFS_DEVICE} ... "
lofiadm -d "${LOFS_DEVICE}"
if [ 0 -ne $? ]; then
exit 1;
else
echo "deleted"
fi
--------------------------------------
enjoy!!! w00h00!!!
#!/bin/sh
#
# Mount an ISO image using a loopback filesystem.
#
if [ -z "$1" -o -z "$2" ]; then
echo "$0 <full_path_to_iso> <mount_point>"
exit 0
fi
# Add the loopback block device.
# This will return the device path under /dev/lofi/.
printf "Creating loopback device to $1 ... "
LOFS_DEVICE=`lofiadm -a "$1"`
if [ 0 -ne $? ]; then
exit 1
else
echo "${LOFS_DEVICE}"
fi
# Now, mount the device to the mount point specified.
printf "Mounting $2 on ${LOFS_DEVICE} ... "
mount -F hsfs -o ro "${LOFS_DEVICE}" "$2"
if [ 0 -ne $? ]; then
lofiadm -d ${LOFS_DEVICE}
exit 1
else
echo "mounted"
fi
-------------------- umount_iso ---------------------------
#!/bin/sh
#
# Unmount an ISO image mounted over the loopback file system.
#
if [ -z "$1" ]; then
echo "$0 <mount_point>"
exit 0
fi
# Find the loopback device in the list of mount points.
LOFS_DEVICE=`mount | grep "$1" | awk '{print $3}'`
if [ -z "${LOFS_DEVICE}" ]; then
echo "Unable to find loopback device for mount point $1"
exit 1
fi
# Unmount the mount point.
printf "Unmounting $1 on ${LOFS_DEVICE} ... "
umount $1
if [ 0 -ne $? ]; then
exit 1
else
echo "unmounted"
fi
# Delete the loopback block device.
printf "Deleting loopback device ${LOFS_DEVICE} ... "
lofiadm -d "${LOFS_DEVICE}"
if [ 0 -ne $? ]; then
exit 1;
else
echo "deleted"
fi
--------------------------------------
enjoy!!! w00h00!!!