Working with ISO images on Solaris
The following two commands will take all data in /home/neal, copy it to the ISO file, and burn the ISO file to a recordable CD.
|
1 2 |
mkisofs -l -L -r -o /local/mycdromfile2.iso /home/neal cdrecord -v /local/mycdromfile2.iso |
The resulting ISO image can be mounted directly from hard drive, without having to burn it to a CD. Here’s how:
|
1 |
mount -F hsfs -o ro `lofiadm -a /export/temp/software.iso` /mountpoint |
The following script allows you to rip a CD-ROM to your hard drive as an ISO file and mount the file as a virtual CD.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
#!/bin/sh # igor@krazyworks.com # # Rip CD-ROM to ISO image, mount, and share clear if [ `uname -a | egrep -ic linux` -gt 0 ] then OSTYPE="Linux" elif [ `uname -a | egrep -ic "sunos|solaris"` -gt 0 ] then OSTYPE="Solaris" else echo "" echo "Unsupported OS: this script will only work under Solaris or Linux." exit fi echo "OS type: $OSTYPE" echo "" echo "This script will create an ISO image of the CD-ROM currently in the" echo "local CD drive on `hostname`. This sceript must be executed as root." echo "The copy process may take over 10 minutes depending on the speed of" echo "the CD drive. During the copy process the script will temporarily" echo "disable the automounter." echo "" if [ "$OSTYPE" = "Solaris" ] then echo "Proceed with the copy process? [y/n]: \c" elif [ "$OSTYPE" = "Linux" ] then echo -n "Proceed with the copy process? [y/n]: " fi read RESPONSE1 if [ "$RESPONSE1" != "y" ] then exit fi #-------------------------------------------- # CREATE ISO IMAGE #-------------------------------------------- echo "" if [ "$OSTYPE" = "Solaris" ] then echo "Enter the location for storing ISO images: \c" elif [ "$OSTYPE" = "Linux" ] then echo -n "Enter the location for storing ISO images: " fi read ISODIR if [ ! -d "$ISODIR" ] then echo "Directory not found: $ISODIR" exit fi echo "" if [ "$OSTYPE" = "Solaris" ] then echo "Enter CD-ROM title: \c" elif [ "$OSTYPE" = "Linux" ] then echo -n "Enter CD-ROM title: " fi read ISONAME ISONAME=`echo "$ISONAME" | sed 's/ /_/g'` if [ -f "$ISODIR/$ISONAME.iso" ] then echo "" if [ "$OSTYPE" = "Solaris" ] then echo "Image $ISODIR/$ISONAME.iso already exists. Do you want to delete it? [y/n]: \c" elif [ "$OSTYPE" = "Linux" ] then echo -n "Image $ISODIR/$ISONAME.iso already exists. Do you want to delete it? [y/n]: " fi read RESPONSE4 if [ "$RESPONSE4" = "y" ] then if [ `df | fgrep -c "$ISODIR/$ISONAME"` -gt 0 ] then unshare $ISODIR/$ISONAME > /dev/null umount $ISODIR/$ISONAME > /dev/null rm $ISODIR/$ISONAME.iso fi else exit fi fi if [ "$OSTYPE" = "Solaris" ] then echo "" echo "Ejecting CD-ROM..." eject cdrom echo "Stopping volume management..." /etc/init.d/volmgt stop echo "" echo "Insert CD-ROM you wish to copy and press enter when ready...\c" read RESPONSE3 echo "Detecting CD..." sleep 10 elif [ "$OSTYPE" = "Linux" ] then echo "" echo -n "Insert CD-ROM you wish to copy and press enter when ready..." read RESPONSE3 sleep 5 fi echo "" echo "Creating ISO image. This process may take several minutes." echo "" if [ "$OSTYPE" = "Solaris" ] then dd if=/dev/rdsk/c0t6d0s2 of="$ISODIR/$ISONAME.iso" bs=1024k elif [ "$OSTYPE" = "Linux" ] then dd if=/dev/cdrom of="$ISODIR/$ISONAME.iso" bs=1024 fi if [ $? -eq 0 ] then echo "" echo "ISO image created: " ls -als "$ISODIR/$ISONAME.iso" else echo "" echo "ISO could not be created." if [ "$OSTYPE" = "Solaris" ] then echo "" echo "Re-enabling volume management..." /etc/init.d/volmgt start fi exit fi #-------------------------------------------- # MOUNT & SHARE ISO IMAGE #-------------------------------------------- echo "" if [ "$OSTYPE" = "Solaris" ] then echo "Do you wish to mount and export this ISO image? [y/n]: \c" elif [ "$OSTYPE" = "Linux" ] then echo -n "Do you wish to mount and export this ISO image? [y/n]: " fi read RESPONSE5 if [ "$RESPONSE5" != "y" ] then exit fi if [ ! -d "$ISODIR/$ISONAME" ] then mkdir "$ISODIR/$ISONAME" fi if [ "$OSTYPE" = "Solaris" ] then echo "" echo "Re-enabling volume management..." /etc/init.d/volmgt start sleep 5 echo "Mounting $ISODIR/$ISONAME.iso $ISODIR/$ISONAME" mount -F hsfs -o ro `lofiadm -a $ISODIR/$ISONAME.iso` $ISODIR/$ISONAME elif [ "$OSTYPE" = "Linux" ] then echo "" echo "Mounting $ISODIR/$ISONAME.iso $ISODIR/$ISONAME" mount "$ISODIR/$ISONAME.iso" "$ISODIR/$ISONAME" -t iso9660 -o ro,unhide,loop=/dev/loop0 > /dev/null fi if [ $? -eq 0 ] then share -F nfs -o ro,anon=0 $ISODIR/$ISONAME > /dev/null echo "" echo "$ISONAME.iso is mounted under $ISODIR/$ISONAME and shared globally in read-only mode." echo "" echo "You can mount this image as virtual CD-ROM from a remote system by running:" echo "mount -o -ro `hostname`:$ISODIR/$ISONAME /local_mountpoint" echo "" else echo "" echo "$ISONAME.iso could not be mounted." exit fi exit |
-
ademuth93
-
Blake
-
Ev dog
-
toysruslover
