Home

share_cdrom_images.sh




Purpose

share_cdrom_images.sh  is a script to mount and share CDROM ISO images. share_cdrom_images.sh can also be used as start/stop script to share one or more CDROM ISO images.



Back to top

License


# CDDL HEADER START
#
# The contents of this file and the script are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END


Back to top

History


Version
Releasedate
Description
1.00
10/24/2005
initial release
1.01
10/26/2005
added support for symbolic links
1.02 08/27/2009
corrected a syntax error


Back to top

Operating system

Solaris 8 and newer


Back to top

Language / type

Bornshell Script


Back to top

Prerequisites

the Solaris lofiadm packages must be installed


Back to top

Usage


  share_cdrom_images.sh [start|stop] [imagefile ...]


imagefile can be the fully qualified path of the ISO file, the name of the ISO file without the path , or the alias for the ISO image as defined in the config file. If the parameter imagefile is ommitted, all ISO images defined are processed.

Example:

bash-2.05# ./share_cdrom_images.sh start
share_cdrom_images.sh - Reading the config file "/etc/share_cdrom_images.conf" ...
share_cdrom_images.sh - Starting the share for "/var/cdimg/iso/sol10x86_companioncd.iso" (Mountpoint is "/tmp/sol10comp") ...
share_cdrom_images.sh - Creating a lofi device for "/var/cdimg/iso/sol10x86_companioncd.iso" ...
share_cdrom_images.sh - Mounting "/tmp/sol10comp" to "/dev/lofi/1" ...
share_cdrom_images.sh - Sharing "/tmp/sol10comp" ...
share_cdrom_images.sh - Starting the share for "/var/cdimg/BootCD_2.0.11_cdrom_with_ISOImage.iso" (Mountpoint is "/tmp/bootcd") ...
share_cdrom_images.sh - Creating a lofi device for "/var/cdimg/BootCD_2.0.11_cdrom_with_ISOImage.iso" ...
share_cdrom_images.sh - Mounting "/tmp/bootcd" to "/dev/lofi/2" ...
share_cdrom_images.sh - Sharing "/tmp/bootcd" ...
share_cdrom_images.sh - Starting the share for "/var/cdimg/vxstor41.iso" (Mountpoint is "/tmp/vxstor") ...
share_cdrom_images.sh - Creating a lofi device for "/var/cdimg/vxstor41.iso" ...
share_cdrom_images.sh - Mounting "/tmp/vxstor" to "/dev/lofi/3" ...
share_cdrom_images.sh - Sharing "/tmp/vxstor" ...
bash-2.05#
bash-2.05# ./share_cdrom_images.sh status
share_cdrom_images.sh - Reading the config file "/etc/share_cdrom_images.conf" ...
share_cdrom_images.sh - Checking the status of  "/var/cdimg/iso/sol10x86_companioncd.iso" (Mountpoint is "/tmp/sol10comp") ...
share_cdrom_images.sh - The lofi device exists (/dev/lofi/1)
share_cdrom_images.sh - The mount exists
share_cdrom_images.sh - The directory is shared
share_cdrom_images.sh - Checking the status of  "/var/cdimg/BootCD_2.0.11_cdrom_with_ISOImage.iso" (Mountpoint is "/tmp/bootcd") ...
share_cdrom_images.sh - The lofi device exists (/dev/lofi/2)
share_cdrom_images.sh - The mount exists
share_cdrom_images.sh - The directory is shared
share_cdrom_images.sh - Checking the status of  "/var/cdimg/vxstor41.iso" (Mountpoint is "/tmp/vxstor") ...
share_cdrom_images.sh - The lofi device exists (/dev/lofi/3)
share_cdrom_images.sh - The mount exists
share_cdrom_images.sh - The directory is shared
bash-2.05#
bash-2.05#
bash-2.05# ./share_cdrom_images.sh stop 
share_cdrom_images.sh - Reading the config file "/etc/share_cdrom_images.conf" ...
share_cdrom_images.sh - Stopping the share for "/var/cdimg/iso/sol10x86_companioncd.iso" (Mountpoint is "/tmp/sol10comp") ...
share_cdrom_images.sh - Unsharing "/tmp/sol10comp" ...
share_cdrom_images.sh - Umounting "/tmp/sol10comp" ...
share_cdrom_images.sh - Removing the lofi device "/dev/lofi/1" for "/var/cdimg/iso/sol10x86_companioncd.iso" ...
share_cdrom_images.sh - Stopping the share for "/var/cdimg/BootCD_2.0.11_cdrom_with_ISOImage.iso" (Mountpoint is "/tmp/bootcd") ...
share_cdrom_images.sh - Unsharing "/tmp/bootcd" ...
share_cdrom_images.sh - Umounting "/tmp/bootcd" ...
share_cdrom_images.sh - Removing the lofi device "/dev/lofi/2" for "/var/cdimg/BootCD_2.0.11_cdrom_with_ISOImage.iso" ...
share_cdrom_images.sh - Stopping the share for "/var/cdimg/vxstor41.iso" (Mountpoint is "/tmp/vxstor") ...
share_cdrom_images.sh - Unsharing "/tmp/vxstor" ...
share_cdrom_images.sh - Umounting "/tmp/vxstor" ...
share_cdrom_images.sh - Removing the lofi device "/dev/lofi/3" for "/var/cdimg/vxstor41.iso" ...
bash-2.05#



Back to top

Configuration & Internas

share_cdrom_images.sh uses a configuration file called /etc/share_cdrom_images.conf if it exists. The format of lines in the config file is

image_file ; mount_point ; mount_options ; share_options ; alias

Mount options and share options are optional; if they are missing the buildin defaults are used. Use a dash '-' to force the use of the defaults for the options.
Use 'NO' for the mount options if you do not want to mount an ISO image.
Use 'NO' for the share options if you do not want to share an ISO image.

The default mount options are -F hsfs -o ro

The default share options are -o ro

The field alias is optional

Empty lines and lines beginning with a hash '#' are ignored.

Example config file:

# image file                                                       mount point                     mount options  share options   alias
# -------------------------------------------------------------------------------------------------------------------------------------
/export/install/cdrom_images/soltools.img                       ;  /export/install/soltools        ; -            ; -             ;perftools
/export/install/cdrom_images/sol-9-u6-supp.img                  ;  /export/install/sol9_supplement ; -            ; -             ;sol9supp
/export/install/cdrom_images/software_companion_sparc_sol9.img  ;  /export/install/sol9_companion  ; -            ; -             ;sol9comp
/export/install/cdrom_images/software_companion_sparc_sol10.img ;  /export/install/sol10_companion ; -            ; -             ;sol10comp
#


If the config file is missing share_cdrom_images.sh uses the images and mount points defined in the script.

share_cdrom_images.sh always checks the current status of the mounts and shares before doing anything. Therefor in case of an error just correct the error and call share_cdrom_images.sh again.




Back to top

Notes

Due to the limitations of lofiadm share_cdrom_images.sh can only handle the first slice of a CDROM.  Therefor, if you want to use the ISO images of CDROMs with more than one slice (e.g. the Solaris installation CDROMs) you must use split_cdrom_isoimage.sh to split the ISO image into slices. Then you can mount and share the files with the slices of the CDROM.

The mount points must exist prior to starting share_cdrom_images.sh

The "ISO Image" can be any file that can be mounted as a block device. For example it could also be the image of a slice created by split_cdrom_isoimage.sh or a file created by something like 'dd if=/dev/rdsk/c0t1d0s0 of=/mnt/slice0.img'. In this case only the mount options must be specified correctly, e.g. -F ufs for slices with UFS filesystems.



Back to top

Download


Download share_cdrom_images.sh



Back to top