#!/bin/bsh
#
# IMPORTANT: READ ALL THE BELOW FIRST!!!
# 
# Mounts a cartridge for use (must have been msyquest'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.
# 
# If your drive is on a different SCSI bus or ID you'll have to change
# the appropriate lines below:
#       change the 4 in -w '4,0' to whatever your SCSI ID is
#       change the scsi0 to whatever your SCSI bus is (shouldn't have to)
#
# 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.

case "$1" in
"") echo "Usage: msyquest <unique-cartridge-vg-number>" 1>&2
    exit 1;
    ;;
esac

/usr/sbin/mkdev -c disk -t 'osdisk' -s 'scsi' -p 'scsi0' -w '4,0'
/bin/sleep 6
/usr/sbin/mkdev -c disk -t 'osdisk' -s 'scsi' -p 'scsi0' -w '4,0'

/usr/sbin/importvg -y"syqvg$1" hdisk1
/usr/sbin/fsck "/dev/syqlv$1"
/usr/sbin/mount /syquest
