From f80a62832bb5f296a730b238677b9b20ace7b993 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Mar 2021 17:31:46 -0500 Subject: improvements --- Makefile | 2 +- hpssacli-2.40-13.0_amd64.sh | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 3e848b7..713813b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ .PHONY: fix sudo = $(shell [ $$(id -u) = 0 ] || echo sudo) fix: - $(sudo) sh hpssacli-2.40-13.0_amd64.sh + $(sudo) sh -x hpssacli-2.40-13.0_amd64.sh diff --git a/hpssacli-2.40-13.0_amd64.sh b/hpssacli-2.40-13.0_amd64.sh index 9255684..e736e79 100644 --- a/hpssacli-2.40-13.0_amd64.sh +++ b/hpssacli-2.40-13.0_amd64.sh @@ -1,22 +1,33 @@ #!/bin/sh -# Thanks to rmp5s on unraid.net for the solution. -# Thanks to Daggr for confirming the solution. -# https://forums.unraid.net/topic/82007-solved-unraid-with-hp-p420i-raid-card-in-hp-proliant-dl380p-g8/ +[ "$(id -u)" = 0 ] || exec sudo -- $0 "$@" -#deb=hpssacli-2.40-13.0_amd64.deb +deb=hpssacli-2.40-13.0_amd64.deb deb=${0%.sh}.deb url=https://downloads.linux.hpe.com/SDR/repo/mcp/pool/non-free/$deb -set -ex -if ! dpkg-query -W hpssacli -then - [ -e "$deb" ] || wget "$url" || curl -O "$url" - dpkg -i "$deb" -fi +install_deb_url() +{ + local url="$1" deb pkg + deb=${url##*/} + pkg=${deb%%-*} + + if ! status=$(dpkg-query -W -f '${Status}' "$pkg") || ! [ "$status" = 'install ok installed' ] + then + [ -e "$deb" ] || wget -c "$url" || curl -O "$url" + dpkg -i "$deb" + fi +} +set -e +install_deb_url "$url" PATH=/opt/hp/hpssacli/bld:$PATH hpssacli controller slot=0 show | grep 'HBA Mode Enabled: True' || hpssacli controller slot=0 modify hbamode=on hpssacli rescan + +# Thanks to rmp5s on unraid.net for the solution & link. +# Thanks to Daggr for confirming the solution. +# +# https://forums.unraid.net/topic/82007-solved-unraid-with-hp-p420i-raid-card-in-hp-proliant-dl380p-g8/ -- cgit v1.2.3