#! /bin/sh #------------------------------------------------------------------------------ # /var/install/bin/twadmin-updatecli - Update the LSI/3ware CLI # # Copyright (c) 2003-2007 Maximilian Pasternak # Copyright (c) 2008-2018 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2003-12-23 max # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #------------------------------------------------------------------------------ # include eislib . /var/install/include/eislib #exec 2>/tmp/twadmin-updatecli-trace-$$.log #set -x if [ "$1" = "quiet" ] then VERBOSE='no' else VERBOSE='yes' fi ### old cli if [ -f /usr/sbin/tw_cli ] then CLI_OLD_VERSION=`/usr/sbin/tw_cli help 2>/dev/null | grep "3ware CLI (version "` CLI_OLD_ERROR=0 else CLI_OLD_VERSION="not installed" CLI_OLD_ERROR=1 fi ### new cli if [ -f /tmp/3DM2_CLI-linux_10.2.2.1_9.5.5.1.zip ] then # v9.5.5.1 (http://www.lsi.com) # check eisfair architecture archive_name=/tmp/3DM2_CLI-linux_10.2.2.1_9.5.5.1.zip elif [ -f /tmp/3DM2_CLI-linux_10-2-2-1_9-5-5-1.zip ] then # v9.5.5.1 (https://docs.broadcom.com/docs/12353043) archive_name=/tmp/3DM2_CLI-linux_10-2-2-1_9-5-5-1.zip elif [ -f /tmp/3DM2_CLI-Linux_10.2.1_9.5.4.zip ] then # v9.5.4 archive_name=/tmp/3DM2_CLI-Linux_10.2.1_9.5.4.zip elif [ -f /tmp/tw_cli-linux-x86-9.5.3.tgz ] then # v9.5.3 archive_name=/tmp/tw_cli-linux-x86-9.5.3.tgz elif [ -f /tmp/tw_cli-linux-x86-9.3.0.7.tgz ] then # v9.3.0.7 archive_name=/tmp/tw_cli-linux-x86-9.3.0.7.tgz elif [ -f /tmp/tw_cli.tgz ] then archive_name=/tmp/tw_cli.tgz fi if [ -f ${archive_name} ] then echo "${archive_name}" | grep -q "\.zip$" if [ $? -eq 0 ] then # zip archive uname -a | grep -q " x86_64 " if [ $? -eq 0 ] then # eisfair-64 unzip -o -p ${archive_name} tdmCliLnx.tgz | tar xzf - -C /tmp tw_cli.x86_64 mv /tmp/tw_cli.x86_64 /tmp/tw_cli else # eisfair-1 unzip -o -p ${archive_name} tdmCliLnx.tgz | tar xzf - -C /tmp tw_cli.x86 mv /tmp/tw_cli.x86 /tmp/tw_cli fi else echo "${archive_name}" | grep -q "\.tgz$" if [ $? -eq 0 ] then # tgz archive tar xzf ${archive_name} -C /tmp tw_cli fi fi fi if [ -f /tmp/tw_cli ] then chmod +x /tmp/tw_cli CLI_NEW_VERSION=`/tmp/tw_cli help 2>/dev/null | grep "3ware CLI (version "` else CLI_NEW_VERSION='' fi case ${CLI_NEW_VERSION} in "3ware CLI (version 1.00.00.013)" ) CLI_NEW_ERROR=0 ;; "3ware CLI (version 2.00.00.015)" ) CLI_NEW_ERROR=0 ;; "3ware CLI (version 2.00.00.032b)" ) CLI_NEW_ERROR=0 ;; "AMCC/3ware CLI (version 2.00.03.017)" ) # v9.3.0.7 CLI_NEW_ERROR=0 ;; "AMCC/3ware CLI (version 2.01.09.004)" ) # v9.5.3 CLI_NEW_ERROR=0 ;; "LSI/3ware CLI (version 2.00.11.020)" ) # v9.5.4 CLI_NEW_ERROR=0 ;; "LSI/3ware CLI (version 2.00.11.022)" ) # v9.5.5.1 CLI_NEW_ERROR=0 ;; "" ) if [ -f /tmp/tw_cli.tgz ] then CLI_NEW_VERSION='invalid' CLI_NEW_ERROR=2 else CLI_NEW_VERSION='not found' CLI_NEW_ERROR=1 fi ;; * ) CLI_NEW_ERROR=3 ;; esac ### print version if [ "$VERBOSE" = "yes" ] then clrhome mecho mecho --info "Due to license restrictions it is not permitted to include the" mecho --info "AMCC/3ware command line interface executable (tw_cli) into an" mecho --info "eisfair package." mecho mecho --info "To install or update the tw_cli please download it from" mecho --info "http://www.broadcom.com/, http://www.lsi.com or http://www.3ware.com/" mecho --info "and save the archive file in the /tmp directory. The file is usally" mecho --info "called 3DM2_CLI-linux_*.zip, tw_cli-linux-x86-*.tgz, tw_cli.tgz or" mecho --info "cli_linux.tgz." mecho mecho "Compatible Versions:" mecho " CLI for Linux Version 7.5.2 - 3ware CLI (version 1.00.00.013)" mecho " CLI for Linux Version 7.6.3 - 3ware CLI (version 2.00.00.015)" mecho " CLI for Linux Version 7.7.0 - 3ware CLI (version 2.00.00.032b)" mecho " CLI for Linux Version 9.3.0.7 - AMCC/3ware CLI (version 2.00.03.017)" mecho " CLI for Linux Version 9.5.3 - AMCC/3ware CLI (version 2.01.09.004)" mecho " CLI for Linux Version 9.5.4 - LSI/3ware CLI (version 2.00.11.020)" mecho " CLI for Linux Version 9.5.5.1 - LSI/3ware CLI (version 2.00.11.022)" mecho mecho "If there is no matching CLI for Linux for your Controller" mecho "please use the CLI for Linux for AMCC/3ware Escalade 7000." mecho mecho -n "Current Version: " mecho --info "$CLI_OLD_VERSION" mecho -n "New Version: " mecho --info "$CLI_NEW_VERSION" mecho if [ "$CLI_NEW_ERROR" = "0" ] then if [ "$CLI_OLD_ERROR" = "0" ] then if /var/install/bin/ask "Install/update the command line interface?" then mecho else CLI_NEW_ERROR=4 mecho mecho --error "Aborted on user Request." mecho fi fi elif [ "$CLI_NEW_ERROR" = "3" ] then mecho --error "The Version of the new CLI is not supported!" mecho --error "A new tw_cli cannot be installed!" mecho else mecho --error "A new tw_cli cannot be installed!" mecho fi fi ### install if [ "$CLI_NEW_ERROR" = "0" ] then mv -f /tmp/tw_cli /usr/sbin/tw_cli chown root: /usr/sbin/tw_cli fi if [ "$CLI_NEW_ERROR" = "0" -a "$VERBOSE" = "yes" ] then mecho --info "Successfully installed $CLI_NEW_VERSION." mecho fi ### clean rm -f /tmp/tw_cli rm -f /tmp/tw_cli.tgz if [ "$VERBOSE" = "yes" ] then anykey fi exit $CLI_NEW_ERROR