From 5ab8fa3a6edf5f92b7b483414501fbb693740155 Mon Sep 17 00:00:00 2001 From: ich777 Date: Mon, 11 Apr 2022 17:29:02 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Eamd-vendor-reset.plg=E2=80=9C=20=C3=A4?= =?UTF-8?q?ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- amd-vendor-reset.plg | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/amd-vendor-reset.plg b/amd-vendor-reset.plg index ccf68ac..999bc85 100644 --- a/amd-vendor-reset.plg +++ b/amd-vendor-reset.plg @@ -13,6 +13,9 @@ +###2022.04.11 +- Added Plugin Update Helper when up-/downgrading unRAID version + ###2022.03.21 - Added change for reset_method for Kernel 5.15+ @@ -97,6 +100,46 @@ modprobe vendor_reset #Check if AMD Vendor Reset is already downloaded check +#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 + if [ ! -z "$(lsmod | grep "vendor_reset")" ]; then modprobe vendor_reset echo