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 floppy drive
33 PATH
="/usr/sbin:/usr/bin"
34 TEXTDOMAIN
="SUNW_OST_OSCMD"
37 USAGE
=`gettext "%s [-I|-s|-f|-i] device"`
40 # *** Shell Function Declarations ***
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" $PROG $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 ***
93 \?) printf "${USAGE}\n" $PROG
97 shift `expr $OPTIND - 1`
99 # get the map information
102 MAP
=`dminfo -v -n $FLOPPY`
103 DEVICE
=`echo $MAP | cut -f1 -d:`
104 TYPE
=`echo $MAP | cut -f2 -d:`
105 FILES
=`echo $MAP | cut -f3 -d:`
106 DEVFILE
=`echo $FILES | cut -f1 -d" "`
108 #if init then do once and exit
110 lform
=`gettext "%s error: %s."`
112 if [ "$FLAG" = "i" ] ; then
113 x
="`eject -q $DEVFILE 2>&1`" # Determine if there is media in drive
117 0) # Media is in the drive.
118 a
="`eject -f $DEVFILE 2>&1`"
122 0) # Media has been ejected
125 1) # Media not ejected
127 if [ "$silent" != "y" ] ; then
128 printf "${lform}\n" $PROG $a >/dev
/tty
134 if [ "$silent" != "y" ] ; then
135 printf "${lform}\n" $PROG $a >/dev
/tty
139 3) # Error - Perhaps drive doesn't support ejection
141 if [ "$silent" != "y" ] ; then
142 printf "${lform}\n" $PROG $a >/dev
/tty
147 1) # No media in drive
152 if [ "$silent" != "y" ] ; then
153 printf "${lform}\n" $PROG $x >/dev
/tty
159 if [ "$silent" != "y" ] ; then
160 printf "${lform}\n" $PROG $x >/dev
/tty
166 # interactive clean up
167 x
="`eject -q $DEVFILE 2>&1`" # Determine if there is media in drive
171 0) # Media is in the drive.
172 a
="`eject -f $DEVFILE 2>&1`"
175 0) # Media has been ejected
178 1) # Media didn't eject
180 if [ "$silent" != "y" ] ; then
181 printf "${lform}\n" $PROG $a >/dev
/tty
187 if [ "$silent" != "y" ] ; then
188 printf "${lform}\n" $PROG $a >/dev
/tty
194 if echo $a |
grep "failed" >/dev
/null
; then
195 while true
# Drive doesn't support eject, so loop
197 c
="`eject -q $DEVFILE 2>&1`" # Is floppy in drive?
199 if [ $d -eq 0 ] ; then # Yes, Floppy in drive
200 form
=`gettext "Please remove the floppy from %s."`
201 if [ "$silent" != "y" ] ; then
202 printf "${form}\n" $DEVICE >/dev
/tty
203 /usr
/5bin
/echo \\007 > /dev
/tty
206 elif echo $c |
grep "NOT" > /dev
/null
; then
207 # No,Floppy NOT in drive
210 else # Error occurred
212 if [ "$silent" != "y" ] ; then
213 printf "${lform}\n" $PROG $a >/dev
/tty
219 else # Some other failure
220 if [ "$silent" != "y" ] ; then
221 printf "${lform}\n" $PROG $a >/dev
/tty
229 1) # No media in the drive
234 if [ "$silent" != "y" ] ; then
235 printf "${lform}\n" $PROG $x >/dev
/tty
241 if [ "$silent" != "y" ] ; then
242 printf "${lform}\n" $PROG $x >/dev
/tty