2 # Copyright 2001 Enhanced Software Technologies Inc.
5 # This software is licensed under the terms of the Free Software Foundation's
6 # General Public License, version 2. See http://www.fsf.org for more
7 # inforation on the General Public License. It is released for public use in
8 # the hope that others will find it useful. Please contact eric@estinc.com
9 # if you have problems. Also check out our backup products at
10 # http://www.estinc.com (grin).
12 # usage: config_sgen_solaris.sh check|[un]install
14 # This configures sgen under Solaris (we hope! :-). Note that this
15 # *CAN* do a reboot of the system. Do NOT call this function unless
16 # you are willing to let it do a reboot of the system! Also note that
17 # this *must* be run as user 'root', since it does highly grokety things.
22 SGEN="/kernel/drv/sgen"
23 SGEN_CONF="/kernel/drv/sgen.conf"
26 if test ! -f $SGEN_CONF; then
27 # sgen.conf not installed...
31 changer_type_count=`grep "changer" $SGEN_CONF | grep -v "^#" | wc -l`
32 target_count=`grep "target=" $SGEN_CONF | grep -v "^#" | wc -l`
34 if test $changer_type_count = 0 -o $target_count = 0; then
35 # sgen.conf not configured
39 # sgen.conf installed, and configured
45 # see if already installed
48 echo "sgen already configured, skipping"
49 return 0 # successfully installed (?)
52 if test ! -f $SGEN; then
53 echo "sgen driver not installed, aborting"
57 echo "configuring sgen driver..."
59 echo 'device-type-config-list="changer"; # BRU-PRO' >>$SGEN_CONF
61 while test $target -le 15; do
62 echo "name=\"sgen\" class=\"scsi\" target=$target lun=0; # BRU-PRO" >>$SGEN_CONF
63 target=`expr $target + 1`
66 echo "Attempting to reload driver..."
67 rem_drv sgen >/dev/null 2>&1
69 if test "$?" != "0"; then
72 echo "Driver was successfully configured, but could not be re-loaded."
73 echo "The system must be rebooted for the driver changes to take effect."
76 while test "$ans" = ""; do
77 printf "Do you want to reboot now (shutdown -g 1 -y -i 6)? [Y/n] "
80 if test "$ans" = "Y"; then
84 if test "$ans" = "N"; then
88 if test "$ans" != "y" -a "$ans" != "n"; then
89 echo "Please enter 'y' or 'n'"
94 if test "$ans" = "y"; then
96 # will be killed by reboot...
98 echo "Waiting for reboot..."
103 # not rebooted, exit with error
114 echo "sgen not configured, skipping"
115 return 0 # successfully uninstalled (?)
118 printf "removing BRU-PRO configuration from $SGEN_CONF..."
119 grep -v "# BRU-PRO" $SGEN_CONF > ${SGEN_CONF}.$$ || return 1
120 cat ${SGEN_CONF}.$$ >${SGEN_CONF} || return 1
121 rm -f ${SGEN_CONF}.$$ >/dev/null || return 1
125 printf "Devices will be reconfigured at next reboot.\n"
129 uname | grep SunOS >/dev/null 2>&1
130 if test $? != 0; then
131 echo "$0: not on Solaris, ABORT!"
146 echo "usage: $0 check|[un]install"