#!/bin/csh clear # # 3ware 3DM install script. (c) 2000-2001 3ware, Inc. All rights reserved. # install.3dm script v1.00.00.002 # #Find what switch was used with install.3dm and set $switch to defined value. # ## set switch default to help. set release = `/bin/uname -s` if ($release == "Linux") then set release = `/bin/uname -r` endif # Find which version operating system is running. if ($release == "FreeBSD") then set dist = "freebsd" else if ($release == "2.2.12-20" || $release == "2.2.12-20smp" || $release == "2.2.14-5.0" || $release == "2.2.14-5.0smp" || $release == "2.2.16-22" || $release == "2.2.16-22smp") then set dist = "redhat" else if ($release == "2.2.13" || $release == "2.2.13-SMP" || $release == "2.2.14" || $release == "2.2.14-SMP" || $release == "2.2.16" || $release == "2.2.16-SMP") then set dist = "suse" endif if ($1 == "--u" || $1 == "uninstall") then set sw1 = "uninstall" else if ($1 == "--i" || $1 == "install") then set sw1 = "install" else if ($1 == "--c" || $1 == "configure") then set sw1 = "configure" else set sw1 = "help" endif ## Check to see if user asked for help. If it was then echo list below. # if ($sw1 == "help") then clear echo " *********************************************" echo " * Switches Supported with install.3dm *" echo " *********************************************" echo "The following switches are supported for use with the Install.3dm script." echo "" echo "--i or install will install 3dm files and create needed configuration files." echo "*** Do not use --i or install when using the 3ware rpm to install 3dm. ***" echo "" echo "--u or uninstall will remove all 3dm components and configuration files." echo "" echo "--c or confiure will run the configuration portion of the install script. It will create needed configuration files." echo "*** Use the --c or configure switch to configure 3dm or to reconfigure 3dm after using s 3ware rpm. ***" echo "" echo "*** Any other options will print this screen. ***" echo "" echo "Example (./install.3dm --i or ./install.3dm install) Will install 3dm files and create 3dm.conf." echo "Example (./install.3dm --u or ./install.3dm uninstall) Will uninstall all 3dm components and configuration files." echo "Example (./install.3dm --c or ./install.3dm configure) Will run the configuration portion of the script to update/create 3dm.conf." echo "" endif if ($sw1 == "--u" || $sw1 == "uninstall") then echo "" echo "Checking for 3dm components to remove.. " ps -uaxwww | grep 3dmd | grep -v grep >/dev/null if ($status == "0") then echo "**** Stopping 3dmd to enable uninstallation. ****" /etc/rc.d/init.d/3w-xxxx stop endif if (-e /etc/rc.d/init.d/3w-xxxx) then echo -n "Removing /etc/rc.d/init.d/3w-xxxx " /bin/rm -f /etc/rc.d/init.d/3w-xxxx echo "done." endif if (-e /usr/local/bin/3dmpn) then echo -n "Removing /usr/local/bin/3dmpn " /bin/rm -f /usr/local/bin/3dmpn echo "done." endif if (-e /sbin/3dmd) then echo -n "Removing /sbin/3dmd " /bin/rm -f /sbin/3dmd echo "done." endif if (-e /etc/3dmd.conf) then set help = `/bin/cat /etc/3dmd.conf | grep HELP | cut -d ' ' -f2` echo -n "Removing 3dm help files " /bin/rm -rf $help echo "done." echo -n "Removing 3dm configuration files " /bin/rm -f /etc/3dmd.conf* echo "done." endif if ($dist == "redhat") then if (-e /etc/rc.d/rc1.d/S403w-xxxx) then echo -n "Removing 3dm links " ## Clean up old style links /bin/rm -f /etc/rc.d/rc1.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc2.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc3.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc4.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc5.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc7.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc0.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc2.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc3.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc4.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc5.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc6.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc7.d/K403w-xxxx endif ## Clean up new style links if (-e /etc/rc.d/rc0.d/K603w-xxxx) then /bin/rm -f /etc/rc.d/rc0.d/K603dmd /bin/rm -f /etc/rc.d/rc1.d/K603dmd /bin/rm -f /etc/rc.d/rc2.d/S403dmd /bin/rm -f /etc/rc.d/rc3.d/S403dmd /bin/rm -f /etc/rc.d/rc4.d/S403dmd /bin/rm -f /etc/rc.d/rc5.d/S403dmd /bin/rm -f /etc/rc.d/rc6.d/K603dmd /bin/rm -f /etc/rc.d/rc7.d/S403dmd endif else if ($dist == "suse") then if (-e /etc/rc.d/rc1.d/S403w-xxxx) then echo -n "Removing 3dm links " ## Clean up old style links /bin/rm -f /etc/rc.d/rc1.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc2.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc3.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc4.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc5.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc0.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc2.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc3.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc4.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc5.d/K403w-xxxx /bin/rm -f /etc/rc.d/rc6.d/K403w-xxxx endif ## Clean up new style links if (-e /etc/rc.d/rc0.d/K603w-xxxx) then echo -n "Removing 3dm links " /bin/rm -f /etc/rc.d/rc0.d/K603w-xxxx /bin/rm -f /etc/rc.d/rcS.d/K603w-xxxx /bin/rm -f /etc/rc.d/rc1.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc2.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc3.d/S403w-xxxx /bin/rm -f /etc/rc.d/rc6.d/K603w-xxxx endif endif echo "3dm removal complete." echo "" endif ## Check to see if install or configure switch was used with install.3dm # if ($sw1 == "install" || $sw1 == "configure") then ## Default values # set default_host = `hostname` set default_sender = "root" set default_rcpt = "3ware_admin" set default_port = "1080" set default_help = "/usr/local/doc" # The default password is "3ware" set default_passwd = "OmwmsK8lKk2" set rebuild_rate = "25" set file_name = "/etc/3dmd.conf" echo -n "Would you like to have email notification enabled (Y/N) [Y]? " set email = $< if ($email == "") then set email = "Y" endif if ($email == "Y" || $email == "y" || $email == "YES" || $email == "Yes" || $email == "yes") then echo -n "Please enter the name of your mail server [$default_host]: " set mail_server = $< if ($mail_server == "") then set mail_server = $default_host endif echo -n "Please enter the name of the user you want sending email notification. [$default_sender]: " set mail_sender = $< if ($mail_sender == "") then set mail_sender = $default_sender endif echo -n "Please enter the name of the user you want receiving email notification. [$default_rcpt]: " set mail_rcpt = $< if ($mail_rcpt == "") then set mail_rcpt = $default_rcpt endif else set mail_server = $default_host set mail_sender = $default_sender set mail_rcpt = $default_rcpt endif echo -n "Would you like to have audio notification enabled when the local application starts or there is an error (Y/N) [Y]? " set audio = $< if ($audio == "") then set audio = "Y" endif echo -n "Please enter the port number you would like to use for web monitoring [$default_port]: " set port = $< if ($port == "") then set port = $default_port endif echo "" echo "*** Important RPM related question. ***" echo "Answer "N" if you are using the install.3dm script to install 3dm." echo " *If you answer "N" install.3dm will install all 3dm components." echo "Answer "Y" if RPM was used for installing the driver/3dm software." echo " *3ware RPM packages install all 3dm components and only need to have" echo " the configuration portion of this script run." echo -n "Was rpm used to install the 3ware driver and/or 3dm (Y/N) [Y]? " set rpm = $< if ($rpm == "" || $rpm == "Y" || $rpm == "YES" || $rpm == "y" || $rpm == "yes") then set help = $default_help else echo -n "Please enter the location of the help documentation. [$default_help]: " set help = $< if ($help == "") then set help = $default_help endif endif ## Delete old backup file then move current file to backup before creating new .conf file. # if ( -e $file_name ) then /bin/rm -f $file_name.bak /bin/mv -f $file_name $file_name.bak endif if ($email == "N" || $email == "n" || $email == "NO" || $email == "No" || $email == "no") then echo "EMAIL No" >> $file_name else echo "EMAIL Yes" >> $file_name endif echo "SERVER $mail_server" >> $file_name echo "SENDER $mail_sender" >> $file_name echo "RCPT $mail_rcpt" >> $file_name if ($audio == "N" || $audio == "n" || $audio == "NO" || $audio == "No" || $audio == "no") then echo "AUDIO No" >> $file_name else echo "AUDIO Yes" >> $file_name endif echo "CALL3WARE No" >> $file_name echo "PORT $port" >> $file_name echo "FW $rebuild_rate" >> $file_name echo "HELP $help/3dm" >> $file_name echo "SNMP No" >> $file_name echo "PASSWORD No" >> $file_name echo "KEY $default_passwd" >> $file_name endif ## Check to see if install switch was used with install.3dm. # if ($sw1 == "install") then ## Figure out where we are # set install_dir = `/bin/pwd` cd /tmp ## Upack 3dm files into /tmp so we can run this directly from the CD. # if (-e $install_dir/3dm-lnx.tgz) then /bin/tar zxf $install_dir/3dm-lnx.tgz # else # /bin/tar zxf $install_dir/3dm-lnx-disk.tgz endif if (-e 3dmd) then /bin/cp -f 3dmd /sbin endif ## Uncomment this line to install the 3dmpn popup window application. #/bin/cp -f 3dmpn /usr/local/bin ## Unpack help files, setup help directory and move files to /usr/local/doc # if (-d /usr/local/doc/3dm) then /bin/rm -rf /usr/local/doc/3dm #Deletes /usr/local/doc/3dm from old installs. endif /bin/mkdir -p $help /bin/tar zxf 3dm-help.tgz -C $help # ## Show Supported distribution list." # # # echo "" # echo " Select Distribution:" # echo " 1. Red Hat 6.1, 6.2, or 7.0, e-smith 4.1.1" # echo " 2. SuSE 6.3, 6.4, or 7.0" # echo " 3. Other" # echo "" # echo -n " Enter 1-3 [1]: " # set value = $< # if ($value == "") then # set value = "3" # endif # # if ($value == "1" || $value == "2") then # if ($value == "1") then # set dist="redhat" # else # set dist="suse" # endif endif if ($sw1 == "install" || $sw1 == "configure") then echo "" echo "*************************************************************************" echo " Refer to the User Guide for help with setting the 3w-xxxx driver to" echo " automatically load with each boot of your system." echo "*************************************************************************" echo "" ## Stop and restart 3dm to re-read 3dm.conf file. # if ($dist == "redhat") then if (-e /etc/rc.d/init.d/3w-xxxx) then /bin/rm -f /etc/rc.d/init.d/3w-xxxx endif if (-e 3w-xxxx.rc.$dist) then /bin/cp -f 3w-xxxx.rc.$dist /etc/rc.d/init.d/3w-xxxx /bin/chmod 755 /etc/rc.d/init.d/3w-xxxx endif ## Setup symbolic links for run levels. #rc0.d Halt /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc0.d/K603w-xxxx #rc1.d Single user /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc1.d/K603w-xxxx #rc2.d Multi-user without network /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc2.d/S403w-xxxx #rc3.d Multi-user with network /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc3.d/S403w-xxxx #rc4.d Not used /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc4.d/S403w-xxxx #rc5.d Multi-user with network and X-windows /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc5.d/S403w-xxxx #rc6.d reboot /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc6.d/K603w-xxxx #rc7.d E-SMITH Version 4.1.1 default run level /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc7.d/S403w-xxxx else if ($dist == "suse") then if (-e /etc/rc.d/init.d/3w-xxxx) then /bin/rm -f /etc/rc.d/init.d/3w-xxxx endif if (-e 3w-xxxx.rc.$dist) then /bin/cp -f 3w-xxxx.rc.$dist /etc/rc.d/init.d/3w-xxxx /bin/chmod 755 /etc/rc.d/init.d/3w-xxxx endif ## Setup symbolic links for run levels. #rc0.d Halt /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc0.d/K603w-xxxx #rcS.d Single user /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rcS.d/K603w-xxxx #rc1.d Multi-user without network /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc1.d/S403w-xxxx #rc2.d Multi-user with network /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc2.d/S403w-xxxx #rc3.d Multi-user with network and X-windows /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc3.d/S403w-xxxx #rc6.d reboot /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/rc6.d/K603w-xxxx else echo "" echo "** Distribution not recognized **" echo "" echo "Manual configuration of /etc/rc* required." echo "The executable name is '/sbin/3dmd'." echo "" exit 0 endif ## Check to see if 3dmd is running. # ps -uaxwww | grep 3dmd | grep -v grep >/dev/null if ($status == "0") then echo "" echo "**** Stopping 3dmd to load new configuration ****" /etc/rc.d/init.d/3w-xxxx stop endif echo "" echo "**** Starting 3dmd using configuration found in /etc/3dm.conf ****" /etc/rc.d/init.d/3w-xxxx start ## Clean up installation if (-e $file_name) then /bin/chmod 660 $file_name endif #? /bin/ln -fs /etc/rc.d/init.d/3w-xxxx /etc/rc.d/init.d/3dmd if (-e 3dmd) then /bin/rm -f 3dmd else if (-e 3dmpn) then /bin/rm -f 3dmpn else if (-e 3w-xxxx.rc.*) then /bin/rm -f 3w-xxxx.rc.* endif endif