From b285b1ae9957006fd3e4b9536f402108ed0fb395 Mon Sep 17 00:00:00 2001 From: Daniel Tomlinson Date: Sat, 7 May 2022 03:55:38 +0100 Subject: [PATCH] update plugin script --- dev.unraid-bat.plg | 54 +++++++++++++++++++++++++++++++++++----------- unraid-bat.plg | 54 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 82 insertions(+), 26 deletions(-) diff --git a/dev.unraid-bat.plg b/dev.unraid-bat.plg index a344881..4369bb0 100644 --- a/dev.unraid-bat.plg +++ b/dev.unraid-bat.plg @@ -7,7 +7,7 @@ - + ]> @@ -21,28 +21,56 @@ + + +&releaseURL; + + + +&releaseMD5URL; + + - -file=$(/usr/bin/ls /boot/config/plugins/&name;/&name;*.txz | grep -v '&version;') -if [ ! -z "$file" ] +local_package_file_md5=$(/usr/bin/md5sum &plugin;/&name;-&version;.txz) +remote_package_file_md5=$(/usr/bin/cat &name;-&version;.md5) + +if test $local_package_file_md5 != remote_package_file_md5 then - filename=$(basename -- $file) - previous="${filename%.*}" - echo "previous version ${previous} found - uninstalling" - removepkg $previous - rm -f $file + echo "*** md5 of download package does not match - removing files and exiting ***" + rm &plugin;/&name;-&version;.txz + rm &name;-&version;.md5 + exit 1 else - echo "no previous version found - first time install" + echo "*** md5 check successful ***" fi - -&releaseURL; -&md5; + + + + file=$(/usr/bin/ls /boot/config/plugins/&name;/&name;*.txz | grep -v '&version;') + if [ ! -z "$file" ] + then + filename=$(basename -- $file) + previous="${filename%.*}" + echo "*** previous version ${previous} found - uninstalling ***" + removepkg $previous + rm -f $file + else + echo "*** no previous version found - first time install ***" + fi + + + +upgradepkg --install-new &plugin;/&name;-&version;.txz + + + + **bat** diff --git a/unraid-bat.plg b/unraid-bat.plg index daddb0d..6642b22 100644 --- a/unraid-bat.plg +++ b/unraid-bat.plg @@ -7,7 +7,7 @@ - + ]> @@ -20,28 +20,56 @@ + + +&releaseURL; + + + +&releaseMD5URL; + + - -file=$(/usr/bin/ls /boot/config/plugins/&name;/&name;*.txz | grep -v '&version;') -if [ ! -z "$file" ] +local_package_file_md5=$(/usr/bin/md5sum &plugin;/&name;-&version;.txz) +remote_package_file_md5=$(/usr/bin/cat &name;-&version;.md5) + +if test $local_package_file_md5 != remote_package_file_md5 then - filename=$(basename -- $file) - previous="${filename%.*}" - echo "previous version ${previous} found - uninstalling" - removepkg $previous - rm -f $file + echo "*** md5 of download package does not match - removing files and exiting ***" + rm &plugin;/&name;-&version;.txz + rm &name;-&version;.md5 + exit 1 else - echo "no previous version found - first time install" + echo "*** md5 check successful ***" fi - -&releaseURL; -&md5; + + + + file=$(/usr/bin/ls /boot/config/plugins/&name;/&name;*.txz | grep -v '&version;') + if [ ! -z "$file" ] + then + filename=$(basename -- $file) + previous="${filename%.*}" + echo "*** previous version ${previous} found - uninstalling ***" + removepkg $previous + rm -f $file + else + echo "*** no previous version found - first time install ***" + fi + + + +upgradepkg --install-new &plugin;/&name;-&version;.txz + + + + **bat**