5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 1992-1993, 1997-2001 by Sun Microsystems, Inc.
25 # All rights reserved.
27 #ident "%Z%%M% %I% %E% SMI"
29 # This a clean script for the CD_ROM
33 PATH
="/usr/sbin:/usr/bin"
34 TEXTDOMAIN
="SUNW_OST_OSCMD"
37 USAGE
=`gettext "%s [-I|-s|-f|-i] device"`
40 # *** Shell Function Definitions ***
44 form
=`gettext "%s: Media in %s is ready. Please, label and store safely."`
45 if [ "$silent" != "y" ] ; then
46 printf "${form}\n" $PROG $DEVICE > /dev
/console
51 form
=`gettext "%s: Error cleaning up device %s."`
52 if [ "$silent" != "y" ] ; then
53 printf "${form}\n" `basename $0` $DEVICE > /dev
/console
58 form
=`gettext "%s: Media in %s is ready. Please, label and store safely."`
59 if [ "$silent" != "y" ] ; then
60 printf "${form}\n" $PROG $DEVICE > /dev
/tty
65 form
=`gettext "%s: Error cleaning up device %s."`
66 if [ "$silent" != "y" ] ; then
67 printf "${form}\n" $PROG $DEVICE > /dev
/tty
68 gettext "Please inform system administrator.\n" > /dev
/tty
73 chown bin
/etc
/security
/dev
/$1
74 chmod 0100 /etc
/security
/dev
/$1
78 # *** Begin Main Program ***
90 \?) printf "${USAGE}\n" $PROG >/dev
/tty
94 shift `expr $OPTIND - 1`
96 # get the map information
99 MAP
=`dminfo -v -n $FLOPPY`
100 DEVICE
=`echo $MAP | cut -f1 -d:`
101 TYPE
=`echo $MAP | cut -f2 -d:`
102 FILES
=`echo $MAP | cut -f3 -d:`
103 DEVFILE
=`echo $FILES | cut -f1 -d" "`
105 #if init then do once and exit
107 lform
=`gettext "%s error: %s."`
109 if [ "$FLAG" = "i" ] ; then
110 x
="`eject -q $DEVFILE 2>&1`" # Determine if there is media in drive
114 0) # Media is in the drive.
115 a
="`eject -f $DEVFILE 2>&1`"
119 0) # Media has been ejected
122 1) # Media not ejected
124 if [ "$silent" != "y" ] ; then
125 printf "${lform}\n" $PROG $a >/dev
/tty
131 if [ "$silent" != "y" ] ; then
132 printf "${lform}\n" $PROG $a >/dev
/tty
136 3) # Error - Perhaps drive doesn't support ejection
138 if [ "$silent" != "y" ] ; then
139 printf "${lform}\n" $PROG $a >/dev
/tty
144 1) # No media in drive
149 if [ "$silent" != "y" ] ; then
150 printf "${lform}\n" $PROG $x >/dev
/tty
156 if [ "$silent" != "y" ] ; then
157 printf "${lform}\n" $PROG $x >/dev
/tty
163 # interactive clean up
164 x
="`eject -q $DEVFILE 2>&1`" # Determine if there is media in drive
168 0) # Media is in the drive.
169 a
="`eject -f $DEVFILE 2>&1`"
172 0) # Media has been ejected
175 1) # Media not ejected
177 if [ "$silent" != "y" ] ; then
178 printf "${lform}\n" $PROG $a >/dev
/tty
184 if [ "$silent" != "y" ] ; then
185 printf "${lform}\n" $PROG $a >/dev
/tty
191 if echo $a |
grep "failed" >/dev
/null
; then
192 while true
# Drive doesn't support eject, so loop
194 c
="`eject -q $DEVFILE 2>&1`" # Is caddy in drive?
196 if [ $d -eq 0 ] ; then # Yes, Caddy in drive
197 form
=`gettext "Please remove the caddy from %s."`
198 if [ "$silent" != "y" ] ; then
199 printf "${form}\n" $DEVICE >/dev
/tty
200 /usr
/5bin
/echo \\007 >/dev
/tty
203 elif echo $c |
grep "NOT" > /dev
/null
; then
204 # No,Caddy NOT in drive
207 else # Error occurred
209 if [ "$silent" != "y" ] ; then
210 printf "${lform}\n" $PROG $a >/dev
/tty
216 else # Some other failure
217 if [ "$silent" != "y" ] ; then
218 printf "${lform}\n" $PROG $a >/dev
/tty
226 1) # No media in the drive
231 if [ "$silent" != "y" ] ; then
232 printf "${lform}\n" $PROG $x >/dev
/tty
238 if [ "$silent" != "y" ] ; then
239 printf "${lform}\n" $PROG $x >/dev
/tty