fd_clean.sh revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file 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
# 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
#
#
# Copyright (c) 1992-1993, 1997-2001 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident "%Z%%M% %I% %E% SMI"
#
# This a clean script for the floppy drive
#
TEXTDOMAIN="SUNW_OST_OSCMD"
export TEXTDOMAIN
#
# *** Shell Function Declarations ***
#
fi
}
fi
}
fi
}
fi
}
}
#
# *** Begin main program ***
#
silent=n
# Parse the argumnets
while getopts Iifs c
do
case $c in
I) FLAG=i
silent=y;;
i) FLAG=$c;;
f) FLAG=$c;;
s) FLAG=$c;;
exit 1 ;;
esac
done
# get the map information
FLOPPY=$1
#if init then do once and exit
if [ "$FLAG" = "i" ] ; then
z="$?"
case $z in
0) # Media is in the drive.
b="$?"
case $b in
0) # Media has been ejected
exit 0;;
1) # Media not ejected
if [ "$silent" != "y" ] ; then
fi
exit 1;;
2) # Error
if [ "$silent" != "y" ] ; then
fi
exit 1;;
3) # Error - Perhaps drive doesn't support ejection
if [ "$silent" != "y" ] ; then
fi
exit 1;;
esac;;
1) # No media in drive
exit 0;;
2) # Error
if [ "$silent" != "y" ] ; then
fi
exit 1;;
3) # Error
if [ "$silent" != "y" ] ; then
fi
exit 1;;
esac
else
# interactive clean up
z="$?"
case $z in
0) # Media is in the drive.
b="$?"
case $b in
0) # Media has been ejected
exit 0;;
1) # Media didn't eject
if [ "$silent" != "y" ] ; then
fi
exit 1;;
2) # Other Error
if [ "$silent" != "y" ] ; then
fi
exit 1;;
3)
while true # Drive doesn't support eject, so loop
do
d="$?"
if [ "$silent" != "y" ] ; then
fi
sleep 3
# No,Floppy NOT in drive
exit 0
else # Error occurred
if [ "$silent" != "y" ] ; then
fi
exit 1
fi
done
else # Some other failure
if [ "$silent" != "y" ] ; then
fi
exit 1
fi;;
esac;;
1) # No media in the drive
exit 0;;
2)
if [ "$silent" != "y" ] ; then
fi
exit 1;;
3)
if [ "$silent" != "y" ] ; then
fi
exit 1;;
esac
fi
exit 2