#!/bin/bsh
#
# IMPORTANT: READ ALL THE BELOW FIRST!!!
#
# Unmounts a cartridge so you can eject it.
# NEVER EJECT A CART THAT HASN'T BEEN USYQUEST'D FIRST!!!!!!!!!!!!!!!!!!!
# Must run as root.
# You can usually ignore any errors that appear as long as the end result
# appears to work.
#
# Make sure the next free /dev/hdisk is hdisk1 or you might lose all the
# data on your existing hdisk1!!!  If you have an hdisk1 then change
# all instances of hdisk1 to hdiskX where X is whatever is the first
# unused drive number.
#
# Change the /syquest mount point to whatever you want it to be.
#
# You have to make a unique cartridge number for each cartridge and
# make sure not to duplicate or forget them.

name=`ls -1 /dev/syqvg*`
base=`/bin/basename $name`

/usr/sbin/umount /syquest
/usr/sbin/varyoffvg $base
/usr/sbin/exportvg  $base

/usr/sbin/rmdev -l 'hdisk1' '-d'
