#!/bin/sh
#       setraid.sh
#
# This script, by default, sets an S3000AH system for ESB2 SATA SW RAID with
# the LSI OpRom using syscfg.  Sample commands for other configurations 
# are shown below the "exit 0".
#
# Note that in the PDK, this is all handled by prepareDeployment 
# (detectBIOS.py), and by setBIOS4RAID.py, so that the SystemInfo.xml
# has this information decoded, and queryProperty can be used to 
# get specific values.

# This is the directory used in an installed OS (with the syscfg rpm).
# Uncomment the line below if running in an installed OS.
# cd /usr/local/syscfg
# This is the directory used by the PDK.  Comment this out if not in PDK.
cd /opt/deploy/Linux/syscfg

# get raid status
echo ./syscfg /d biossettings group 'IDE Controller' 'Configure SATA as RAID'
./syscfg /d biossettings group "IDE Controller" "Configure SATA as RAID"

# enable Software RAID on S3000
echo ./syscfg /bcs 'IDE Controller' 'Configure SATA as RAID' 0001
./syscfg /bcs "IDE Controller" "Configure SATA as RAID" 0001

# enable Matrix RAID
# ./syscfg /bcs "IDE Controller" "SATA RAID OPROM" 0001
# enable LSI RAID
echo "./syscfg /bcs 'IDE Controller' 'SATA RAID OPROM' 0000"
./syscfg /bcs "IDE Controller" "SATA RAID OPROM" 0000

exit 0

#ESB2 ATA controller
#    'NSW1U'   : '"ATA Controller Configuration" "Configure SATA as RAID"',
#    'NSC2U'   : '"ATA Controller Configuration" "Configure SATA as RAID"',
#    'SR2500LX': '"ATA Controller Configuration" "Configure SATA as RAID"',
#    'TIGH2U'  : '"ATA Controller Configuration" "Configure SATA as RAID"',
./syscfg /d biossettings group "ATA Controller Configuration" "Configure SATA as RAID"
#    'S3000'   : '"IDE Controller" "Configure SATA as RAID"',
./syscfg /d biossettings group "IDE Controller" "Configure SATA as RAID"

# LSI 1068 SCSI controller
#    'NSC2U'   : '"Mass Storage Controller Configuration" "Configure SAS as SW RAID"',
#    'SR2500LX': '"Mass Storage Controller Configuration" "Configure SAS as SW RAID"',
#    'TIGH2U'  : '"Mass Storage Controller Configuration" "Configure SAS as SW RAID"',
#    'TIGW1U'  : '"Mass Storage Controller Configuration" "Configure SAS as SW RAID"',
./syscfg /d biossettings group "Mass Storage Controller Configuration" "Configure SAS as SW RAID"

# if the above command on S5000 LSI 1068 returns 
#    "Unable to read the BIOS settings group"
# then it must have the HW RAID button enabled (no options to change)

# to enable SW RAID for above 
./syscfg /bcs "Mass Storage Controller Configuration" "Configure SAS as SW RAID" 0001


