Compare commits

..

3 Commits

Author SHA1 Message Date
44c0579666
test 2023-06-18 15:58:43 +02:00
ich777
46a05ab553 added GitHub API check
- use GitHub API to detect latest version from selected package
- save md5 in packages directory
2022-07-21 06:10:24 +02:00
ich777
95aa2585d6 cleanup and necessary changes
- removed wait for network
- cleanup
- necessary changes for 6.11+
2022-07-19 10:26:37 +02:00
2 changed files with 77 additions and 68 deletions

View File

@ -2,19 +2,24 @@
<!DOCTYPE PLUGIN [
<!ENTITY name "AMD-Vendor-Reset">
<!ENTITY author "ich777">
<!ENTITY version "2022.04.11">
<!ENTITY gitURL "https://raw.githubusercontent.com/&author;/unraid-amd-vendor-reset/master">
<!ENTITY version "2022.07.21">
<!ENTITY gitURL "https://git.lat/Flummi/unraid-amd-vendor-reset/raw/branch/master">
<!ENTITY pluginURL "&gitURL;/amd-vendor-reset.plg">
<!ENTITY plugin "/boot/config/plugins/amd-vendor-reset">
<!ENTITY emhttp "/usr/local/emhttp/plugins/AMD-Vendor-Reset">
<!ENTITY packages "/boot/config/plugins/amd-vendor-reset/packages">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="6.10.0-beta17">
<CHANGES>
###2022.04.11
- Added Plugin Update Helper when up-/downgrading unRAID version
###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.03.21
- Added change for reset_method for Kernel 5.15+
@ -38,34 +43,15 @@ This package contains the Vendor Reset module for Polaris, Vega10/20 and Navi10/
<FILE Run="/bin/bash">
<INLINE>
KERNEL_V="$(uname -r)"
PACKAGE="gnif_vendor_reset-plugin-${KERNEL_V}"
DL_URL="https://github.com/ich777/unraid-amd-vendor-reset/releases/download/$KERNEL_V"
#Wait for Network and timeout after 30 seconds
HOST="8.8.8.8"
for i in {1..10}; do
ping -c1 $HOST &amp;> /dev/null &amp;&amp; break;
done
if [ ! -d "&plugin;/packages/${KERNEL_V%%-*}" ]; then
mkdir -p "&plugin;/packages/${KERNEL_V%%-*}"
fi
#Check for old packages
rm -rf $(ls -d &plugin;/packages/* | grep -v "${KERNEL_V%%-*}")
if [ ! -f "&plugin;/AMD-Vendor-Reset.png" ]; then
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/&name;.png" "https://raw.githubusercontent.com/ich777/docker-templates/master/ich777/images/gnif.png"
fi
download() {
#Download vendor-reset
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz" "${DL_URL}/${PACKAGE}-1.txz" ; then
if [ "$(md5sum "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz" | cut -d ' ' -f1)" != "$(wget -qO- "${DL_URL}/${PACKAGE}-1.txz.md5" | cut -d ' ' -f1)" ]; then
# Download vendor-reset
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
@ -74,12 +60,14 @@ else
echo
echo "-----ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR-----"
echo "----------------------Can't download AMD Vendor Reset--------------------------"
rm -rf &plugin; &emhttp;
exit 1
fi
}
check() {
if [ ! -f "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz" ]; then
if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then
LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/ich777/unraid-amd-vendor-reset/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
echo
echo "-----------------Downloading AMD Vendor Reset, please wait...!----------------"
echo "----------This could take some time, please don't close this window!----------"
@ -91,15 +79,70 @@ fi
}
install() {
#Install AMD Vendor Reset
/sbin/installpkg "&plugin;/packages/${KERNEL_V%%-*}/${PACKAGE}-1.txz"
# Install AMD Vendor Reset
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
depmod -a
modprobe vendor_reset
}
activate() {
# Modprobe AMD Vendor Reset
/sbin/modprobe vendor_reset
}
# Define Variables
KERNEL_V="$(uname -r)"
PACKAGE="gnif_vendor_reset"
DL_URL="https://github.com/ich777/unraid-amd-vendor-reset/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%%-*}")
if [ ! -f "&plugin;/AMD-Vendor-Reset.png" ]; then
wget -q -nc --show-progress --progress=bar:force:noscroll -O "&plugin;/&name;.png" "https://raw.githubusercontent.com/ich777/docker-templates/master/ich777/images/gnif.png"
fi
#Check if AMD Vendor Reset is already downloaded
check
# Check if AMD Vendor Reset module is already installed
if ! modinfo vendor_reset -0 >/dev/null 2>&amp;1 ; then
echo
echo "-----------------Installing AMD Vendor Reset, please wait...!-----------------"
install > /dev/null
activate
echo
echo "----------------Installation of AMD Vendor Reset successful-------------------"
echo
else
activate
echo
echo "----------------Installation of AMD Vendor Reset successful-------------------"
fi
# Change reset_method for installed AMD VGA adapters for Kernel 5.15+
# https://github.com/gnif/vendor-reset/issues/46#issuecomment-992282166
TARGET_V="5.14.99"
COMPARE="$(uname -r | cut -d '-' -f1)
$TARGET_V"
if [ "$TARGET_V" != "$(echo "$COMPARE" | sort -V | tail -1)" ]; then
while read -r line
do
echo 'device_specific' &gt; $(find /sys/bus/pci/devices/* -name "*$line")/reset_method
done &lt;&lt;&lt; "$(lspci -nn | grep -E "VGA compatible controller|Display controller" | grep -E "AMD|ATI|Advanced Micro Devices" | awk '{print $1}')"
fi
#Install icon
if [ ! -f "&emhttp;/images/&name;.png" ]; then
if [ ! -d "&emhttp;/images" ]; then
mkdir -p &emhttp;/images
fi
cp &plugin;/&name;.png &emhttp;/images/
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"
@ -140,40 +183,6 @@ if [ -z "$(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delet
echo "/usr/bin/plugin_update_helper" | at now &gt; /dev/null 2&gt;&amp;1
fi
if [ ! -z "$(lsmod | grep "vendor_reset")" ]; then
modprobe vendor_reset
echo
echo "------------Nothing to do, AMD Vendor Reset is already installed!-------------"
echo
else
echo
echo "-----------------Installing AMD Vendor Reset, please wait...!-----------------"
install > /dev/null
echo
echo "----------------Installation of AMD Vendor Reset successful-------------------"
echo
fi
#Change reset_method for installed AMD VGA adapters for Kernel 5.15+
#https://github.com/gnif/vendor-reset/issues/46#issuecomment-992282166
TARGET_V="5.14.99"
COMPARE="$(uname -r | cut -d '-' -f1)
$TARGET_V"
if [ "$TARGET_V" != "$(echo "$COMPARE" | sort -V | tail -1)" ]; then
while read -r line
do
echo 'device_specific' &gt; $(find /sys/bus/pci/devices/* -name "*$line")/reset_method
done &lt;&lt;&lt; "$(lspci -nn | grep -E "VGA compatible controller|Display controller" | grep -E "AMD|ATI|Advanced Micro Devices" | awk '{print $1}')"
fi
#Install icon
if [ ! -f "&emhttp;/images/&name;.png" ]; then
if [ ! -d "&emhttp;/images" ]; then
mkdir -p &emhttp;/images
fi
cp &plugin;/&name;.png &emhttp;/images/
fi
</INLINE>
</FILE>

View File

@ -2,7 +2,7 @@
mkdir ${DATA_DIR}/vendor-reset
mkdir -p ${DATA_DIR}/vendor-reset/vendorreset/lib/modules/${UNAME}
cd ${DATA_DIR}/vendor-reset
git clone https://github.com/gnif/vendor-reset
git clone https://git.lat/Flummi/vendor-reset.git
cd ${DATA_DIR}/vendor-reset/vendor-reset
git checkout master
@ -28,7 +28,7 @@ mkdir $TMP_DIR/$VERSION/install
tee $TMP_DIR/$VERSION/install/slack-desc <<EOF
|-----handy-ruler------------------------------------------------------|
$PLUGIN_NAME: $PLUGIN_NAME
$PLUGIN_NAME: Source: https://github.com/gnif/vendor-reset
$PLUGIN_NAME: Source: https://git.lat/Flummi/vendor-reset.git
$PLUGIN_NAME:
$PLUGIN_NAME: Custom $PLUGIN_NAME for Unraid Kernel v${UNAME%%-*} by ich777
$PLUGIN_NAME: