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. [NOTE FROM ERIC: Note that
9 # this is now unmaintained, unless someone wishes to volunteer. In other
10 # words, if you have a problem with this script, please fix it and forward
11 # a new version of the script with your EMAIL address as the one to contact
14 # usage: config_sgen_solaris.sh check|[un]install
16 # This configures sgen under Solaris (we hope! :-). Note that this
17 # *CAN* do a reboot of the system. Do NOT call this function unless
18 # you are willing to let it do a reboot of the system! Also note that
19 # this *must* be run as user 'root', since it does highly grokety things.
24 SGEN="/kernel/drv/sgen"
25 SGEN_CONF="/kernel/drv/sgen.conf"
28 if test ! -f $SGEN_CONF; then
29 # sgen.conf not installed...
33 changer_type_count=`grep "changer" $SGEN_CONF | grep -v "^#" | wc -l`
34 target_count=`grep "target=" $SGEN_CONF | grep -v "^#" | wc -l`
36 if test $changer_type_count = 0 -o $target_count = 0; then
37 # sgen.conf not configured
41 # sgen.conf installed, and configured
47 # see if already installed
50 echo "sgen already configured, skipping"
51 return 0 # successfully installed (?)
54 if test ! -f $SGEN; then
55 echo "sgen driver not installed, aborting"
59 echo "configuring sgen driver..."
61 echo 'device-type-config-list="changer"; # BRU-PRO' >>$SGEN_CONF
63 while test $target -le 15; do
64 echo "name=\"sgen\" class=\"scsi\" target=$target lun=0; # BRU-PRO" >>$SGEN_CONF
65 target=`expr $target + 1`
68 echo "Attempting to reload driver..."
69 rem_drv sgen >/dev/null 2>&1
71 if test "$?" != "0"; then
74 echo "Driver was successfully configured, but could not be re-loaded."
75 echo "The system must be rebooted for the driver changes to take effect."
78 while test "$ans" = ""; do
79 printf "Do you want to reboot now (shutdown -g 1 -y -i 6)? [Y/n] "
82 if test "$ans" = "Y"; then
86 if test "$ans" = "N"; then
90 if test "$ans" != "y" -a "$ans" != "n"; then
91 echo "Please enter 'y' or 'n'"
96 if test "$ans" = "y"; then
98 # will be killed by reboot...
100 echo "Waiting for reboot..."
105 # not rebooted, exit with error
116 echo "sgen not configured, skipping"
117 return 0 # successfully uninstalled (?)
120 printf "removing BRU-PRO configuration from $SGEN_CONF..."
121 grep -v "# BRU-PRO" $SGEN_CONF > ${SGEN_CONF}.$$ || return 1
122 cat ${SGEN_CONF}.$$ >${SGEN_CONF} || return 1
123 rm -f ${SGEN_CONF}.$$ >/dev/null || return 1
127 printf "Devices will be reconfigured at next reboot.\n"
131 uname | grep SunOS >/dev/null 2>&1
132 if test $? != 0; then
133 echo "$0: not on Solaris, ABORT!"
148 echo "usage: $0 check|[un]install"