- use GitHub API to detect latest version from selected package - save md5 in packages directory
216 lines
7.4 KiB
XML
216 lines
7.4 KiB
XML
<?xml version='1.0' standalone='yes'?>
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "hpsahba">
|
|
<!ENTITY author "ich777">
|
|
<!ENTITY version "2022.07.21">
|
|
<!ENTITY gitURL "https://github.com/&author;/unraid-&name;/raw/master">
|
|
<!ENTITY pluginURL "&gitURL;/&name;.plg">
|
|
<!ENTITY plugin "/boot/config/plugins/&name;">
|
|
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
|
|
<!ENTITY packages "/boot/config/plugins/&name;/packages">
|
|
]>
|
|
|
|
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="6.9.0-RC2" icon="hdd-o">
|
|
|
|
<CHANGES>
|
|
|
|
###2022.07.21
|
|
- Version detection from package via GitHub API
|
|
- Save md5 in packages directory
|
|
|
|
###2022.07.19
|
|
- Necessary changes for unRAID 6.11+
|
|
|
|
###2022.04.11
|
|
- Added Plugin Update Helper when up-/downgrading unRAID version
|
|
|
|
###2021.06.23
|
|
- Changed package download repo
|
|
|
|
###2021.03.25
|
|
- Added wait for network and timout
|
|
|
|
###2021.03.24
|
|
- Corrected typos
|
|
|
|
###2021.01.29
|
|
- Initial release
|
|
|
|
###2021.01.26
|
|
- Initial prerelease for testing
|
|
|
|
</CHANGES>
|
|
|
|
<FILE Name="&emhttp;/README.md">
|
|
<INLINE>
|
|
**hpsahba**
|
|
|
|
This Plugin enables/disables HBA mode on some HP Smart Array controllers and installs the tool 'hpsahba'.
|
|
As mentioned in the Github Repo: _CAUTION: This tool will destroy your data and may damage your hardware!_
|
|
For further information go to the source Github repository: https://github.com/im-0/hpsahba.
|
|
|
|
Warning, this "workaround" comes with a few downsides:
|
|
- You have to set the controller type to SAT to get temperature readings.
|
|
- TRIM might now work (needs further testing).
|
|
|
|
Tested on following hardware so far:
|
|
HP Smart Array P410i
|
|
HP Smart Array P420i Firmware Version 6.0
|
|
HP Smart Array P812
|
|
Hewlett-Packard Company Smart Array G6 controllers / P410 (PCI ID: 103c:323a, board ID: 0x3243103c, firmware: 6.64)
|
|
Hewlett-Packard Company Smart Array G6 controllers / P212 (PCI ID: 103c:323a, board ID: 0x3241103c, firmware: 6.64)
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash">
|
|
<INLINE>
|
|
|
|
download() {
|
|
# Download hpsahba Patch
|
|
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}" "${DL_URL}/${LAT_PACKAGE}" ; then
|
|
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5" "${DL_URL}/${LAT_PACKAGE}.md5"
|
|
if [ "$(md5sum &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE} | awk '{print $1}')" != "$(cat &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5 | awk '{print $1}')" ]; then
|
|
echo
|
|
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR------"
|
|
echo "--------------------------------CHECKSUM ERROR!---------------------------------"
|
|
rm -rf &plugin; &emhttp;
|
|
exit 1
|
|
fi
|
|
echo
|
|
echo "-------------Successfully downloaded hpsahba Patch, please wait...!------------"
|
|
else
|
|
echo
|
|
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR-----"
|
|
echo "------------------------Can't download hpsahba Patch---------------------------"
|
|
rm -rf &plugin; &emhttp;
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
check() {
|
|
if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then
|
|
LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/ich777/unraid-hpsahba/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
|
|
echo
|
|
echo "-----------------Downloading hpsahba Patch, please wait...!--------------------"
|
|
echo "-----------This could take some time, please don't close this window!----------"
|
|
download
|
|
else
|
|
echo
|
|
echo "-------------------------hpsahba Patch found locally!--------------------------"
|
|
fi
|
|
}
|
|
|
|
install() {
|
|
# Install hpsahba Patch
|
|
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
|
|
depmod -a
|
|
}
|
|
|
|
patch() {
|
|
# Patching files
|
|
/sbin/modprobe -r hpsa
|
|
rm -rf /lib/modules/$(uname -r)/kernel/drivers/scsi/hpsa.ko.xz
|
|
}
|
|
|
|
activate() {
|
|
# Modprobe hpsahba Patch
|
|
if [ "$(cat /sys/module/hpsa/parameters/hpsa_use_nvram_hba_flag 2>/dev/null)" != "Y" ]; then
|
|
/sbin/modprobe -r hpsa
|
|
/sbin/modprobe hpsa hpsa_use_nvram_hba_flag=1
|
|
fi
|
|
|
|
}
|
|
|
|
# Define Variables
|
|
KERNEL_V="$(uname -r)"
|
|
PACKAGE="hpsahba"
|
|
DL_URL="https://github.com/ich777/unraid-hpsahba/releases/download/$KERNEL_V"
|
|
|
|
if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then
|
|
mkdir -p "&packages;/${KERNEL_V%%-*}"
|
|
fi
|
|
|
|
# Check for old packages
|
|
rm -rf $(ls -d &packages;/* | grep -v "${KERNEL_V%%-*}")
|
|
|
|
# Check if hpsahba Patch is allready downloaded and installed
|
|
check
|
|
if [ ! -z "$(modinfo hpsa | grep "enable HBA mode")" ]; then
|
|
activate
|
|
echo
|
|
echo "------------------Installation of hpsahba Patch successful---------------------"
|
|
echo
|
|
else
|
|
echo
|
|
echo "-------------------Installing hpsahba Patch, please wait...!-------------------"
|
|
patch
|
|
install > /dev/null
|
|
activate
|
|
echo
|
|
echo "------------------Installation of hpsahba Patch successful---------------------"
|
|
echo
|
|
fi
|
|
|
|
#Check if Plugin Update Helper is downloaded and up-to-date
|
|
if [ ! -f &plugin;/plugin_update_helper ]; then
|
|
wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper"
|
|
else
|
|
CUR_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')"
|
|
if [ ! -s /tmp/update-helper ]; then
|
|
echo "$(wget -T5 -qO- https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper | grep -E "Plugin-Update-Helper version:" | awk '{print $4}')" > /tmp/update-helper
|
|
AVAIL_V="$(cat /tmp/update-helper)"
|
|
else
|
|
AVAIL_V="$(cat /tmp/update-helper)"
|
|
fi
|
|
if [ ! -z "$AVAIL_V" ]; then
|
|
COMPARE="$(sort -V <(echo -e "${AVAIL_V}\n$CUR_V") | tail -1)"
|
|
if [ "$CUR_V" != "$COMPARE" ]; then
|
|
wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
#Check if Plugin Update Helper is installed and up to date
|
|
if [ ! -f /usr/bin/plugin_update_helper ]; then
|
|
cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper
|
|
chmod +x /usr/bin/plugin_update_helper
|
|
else
|
|
PLUGIN_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')"
|
|
INST_V="$(grep -E "Plugin-Update-Helper version:" /usr/bin/plugin_update_helper | awk '{print $4}')"
|
|
COMPARE="$(sort -V <(echo -e "${PLUGIN_V}\n$INST_V") | tail -1)"
|
|
if [ "$INST_V" != "$COMPARE" ]; then
|
|
kill $(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}') 2>/dev/null
|
|
sleep 1
|
|
cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper
|
|
chmod +x /usr/bin/plugin_update_helper
|
|
fi
|
|
fi
|
|
|
|
#Start Plugin Update Helper
|
|
if [ -z "$(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}')" ]; then
|
|
echo "/usr/bin/plugin_update_helper" | at now > /dev/null 2>&1
|
|
fi
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
|
|
echo "---------------------------------------"
|
|
echo "------Uninstalling hpsahba Patch-------"
|
|
echo "---------------------------------------"
|
|
# Remove plugin related files
|
|
rm -rf &plugin;
|
|
rm -rf &emhttp;
|
|
echo
|
|
echo "----------------------------------------------------------------------------"
|
|
echo "----------hpsahba Patch uninstalled, please reboot your server!-------------"
|
|
echo "----------------------------------------------------------------------------"
|
|
echo
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
</PLUGIN>
|