current_year="$(date +%Y)"
copy_right="(c) Copyright 2025 Hewlett Packard Enterprise Development LP "
HELP()
{
echo "Firmware Flash Components for Linux - HPE MSA 1040/2040/1050/2050/1060/2060/2070"
echo $copy_right
echo ""
echo " This Linux Smart Component contains firmware updates for SFF/LFF hard drive models in HPE MSA 1040/2040/1050/2050/1060/2060/2070 Storage System."
echo ""
echo "OPTIONS for ROM Update"
echo ""
echo "   -d, --disk Disk       Set custom drive location(s) to flash "
echo "   -s, --silent          Do not display any text"
echo "   -n, --target IPADDR   Set Ip address (*)"
echo "   -l, --user UNAME      Set username (*)"
echo "   -p, --passwd PASSWORD Set password (*)"
echo " Options marked (*) are required if not set in OA_USERNAME, OA_PASSWORD, OA_ADDRESS env variables"
echo ""
echo "Activity logs are kept in /var/cpq/Component.log file"
echo ""
exit 0
}
if [ "$1" == "--help" ] || [ "$1" == "-h" ] || [ "$1" == "" ] ; then
HELP
fi
maxargs=${#@}
args[maxargs]=
aflag=0
index=0
argindex=0
until [ $index -ge $maxargs ]
do
case "$1" in
-s | --silent ) aflag=1;args[$argindex]="$1"; let "argindex += 1"
let "index += 1"; shift;;
*) args[$argindex]="$1"; let "argindex += 1"
let "index += 1";shift;;
esac
done
if [ $aflag == 0 ] ; then
echo "Firmware Flash Components for Linux - HPE MSA 1040/2040/1050/2050/1060/2060/2070"
echo $copy_right
echo ""
echo "VERSION: 0016"
echo ""
echo "Visit the URL https://www.hpe.com/storage/MSAHealthCheck to know more about MSA Health Check Tool."
echo ""
echo "Important Notes:"
cat <<-%IMP_NOTES%
 Please refer to the Release Notes for the complete listing of fixes and enhancements corresponding to this firmware.     

WARNING! Do not power cycle or restart devices during a firmware update. If the update is interrupted or there is a power failure, the module could become inoperative. If this occurs, contact technical support. The module may need to be returned to the factory for reprogramming.  

IMPORTANT: Ensure that no other user is performing administrative functions on the HPE MSA Storage System.  

IMPORTANT: Drive firmware upgrades on the HPE MSA Storage System MUST be initiated during a maintenance period with minimal to no I/O load from attached systems. Select and schedule an appropriate time to perform an online upgrade. To ensure the success of an online upgrade, selecting the appropriate time is essential. Because the online firmware upgrade is performed while host I/Os are being serviced, the I/O load can impact the upgrade process. Selecting a period of minimal to no I/O activity will ensure the upgrade completes as quickly as possible, and will avoid disruptions to hosts and applications due to timeouts. 

NOTE: As with any other firmware upgrade it is a recommended best practice to ensure that you have a full backup prior to the upgrade.  All firmware flash progress messages are logged to /var/cpq/MSA-Date~Time~ControllerSerialNumber.log and flash summary is logged to /var/cpq/Component.log.  

IMPORTANT: Please refer to the best practices document for special considerations regarding the pre-install conditions for flashing hard drives in HPE MSA Storage System.  

IMPORTANT: HTTPS or SSH service must be enabled on the storage system being updated and the corresponding connection must not be blocked by any firewall on the host system where the smart component is being executed. The Smart Component will manage the SFTP/FTP settings and PFU settings (enabled or disabled) in the storage system during flashing.  

IMPORTANT:  The Smart Component will flash multiple drives of the same family while minimizing risk of damaging drives. Flashing multiple drive concurrently can reduce overall process time.
%IMP_NOTES%
echo ""
chmod a+x ./DHFlash;./DHFlash "${args[@]}"
_RESULT=$?
else
_RESULT=5
fi
if [ $aflag == 1 ] ; then
chmod a+x ./DHFlash;./DHFlash "${args[@]}"
_RESULT=$?
fi
exit $_RESULT
