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 all tape drives
33 PATH
="/usr/sbin:/usr/bin"
34 TEXTDOMAIN
="SUNW_OST_OSCMD"
37 USAGE
=`gettext "%s [-I|-s|-f|-i] device"`
40 # *** Shell Function Declarations ***
45 form
=`gettext "%s: Media in %s is ready. Please, label and store safely."`
46 if [ "$silent" != "y" ] ; then
47 printf "${form}\n" $PROG $DEVICE > /dev
/console
52 form
=`gettext "%s: Error cleaning up device %s."`
53 if [ "$silent" != "y" ] ; then
54 printf "${form}\n" $PROG $DEVICE > /dev
/console
59 form
=`gettext "%s: Media in %s is ready. Please, label and store safely."`
60 if [ "$silent" != "y" ] ; then
61 printf "${form}\n" $PROG $DEVICE > /dev
/tty
66 form
=`gettext "%s: Error cleaning up device %s."`
67 if [ "$silent" != "y" ] ; then
68 printf "${form}" $PROG $DEVICE > /dev
/tty
69 gettext "Please inform system administrator.\n" > /dev
/tty
74 chown bin
/etc
/security
/dev
/$1
75 chmod 0100 /etc
/security
/dev
/$1
88 \?) printf "${USAGE}\n" $PROG >/dev
/tty
92 shift `expr $OPTIND - 1`
94 # get the map information
97 MAP
=`dminfo -v -n $TAPE`
98 DEVICE
=`echo $MAP | cut -f1 -d:`
99 TYPE
=`echo $MAP | cut -f2 -d:`
100 FILES
=`echo $MAP | cut -f3 -d:`
101 DEVFILE
=`echo $FILES | cut -f1 -d" "`
103 #if init then do once and exit
105 if [ "$FLAG" = "i" ] ; then
106 x
="`mt -f $DEVFILE rewoffl 2>&1`"
112 # if this is a open reel tape than we a sucessful
113 # else must be a cartrige tape we failed
115 if mt
-f $DEVFILE status
2>&1 |
grep "no tape loaded" >/dev
/null
; then
125 # only one error mesage is satisfactory
127 if echo $x |
grep "no tape loaded" >/dev
/null
; then
138 # clean up failed exit with error
146 # interactive clean up
147 x
="`mt -f $DEVFILE rewoffl 2>&1`"
153 # if this is a open reel tape than we a sucessful
154 # else must be a cartrige tape we must retry until user removes tape
156 if mt
-f $DEVFILE status
2>&1 |
grep "no tape loaded" > /dev
/null
; then
162 if mt
-f $DEVFILE status
2>&1 |
grep "no tape loaded" > /dev
/null
; then
166 form
=`gettext "Please remove the tape from the %s."`
167 if [ "$silent" != "y" ] ; then
168 printf "${form}\n" $DEVICE >/dev
/tty
169 /usr
/5bin
/echo \\007 >/dev
/tty
177 # only one error mesage is satisfactory
179 if echo $x |
grep "no tape loaded" > /dev
/null
; then
190 # clean up failed exit with error