From 648f6634722417b8fdf6c454d02182dd8dc06b2c Mon Sep 17 00:00:00 2001 From: Derek Macias Date: Mon, 21 Dec 2015 00:25:19 -0700 Subject: [PATCH] add packages, update install/remove scripts --- plugins/libvirtwol.plg | 94 +++++++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 34 deletions(-) diff --git a/plugins/libvirtwol.plg b/plugins/libvirtwol.plg index f2fb505b..2454bb9f 100644 --- a/plugins/libvirtwol.plg +++ b/plugins/libvirtwol.plg @@ -3,27 +3,28 @@ - - - - - + + + + + + + - ]> - + + +###2015.12.21 +- add unRAID version check +- add md5 package ckeck +- convert install and remove scripts ###2015.12.01 - added fix for other packet sizes ###2015.11.18 @@ -62,10 +63,17 @@ This Plugin installs libvirt wake on lan for unRaid 6.1 All dependencies are in - -"https://github.com/&author;/&name;/archive/&version;.tar.gz" + +&gitURL;/archive/&plgname;.txz + + + + +&gitURL;/archive/&plgname;.md5 -if [ ! -d &emhttp; ]; then - mkdir -p &emhttp; +#Verify unRAID Version +source /etc/unraid-version +if [[ ${version:0:3} == 6.0 ]]; then + echo "unRAID version 6.1 or higher is required" + exit 1 fi -tar -zxf &plugin;/&name;-&version;.tar.gz --strip=1 -C &emhttp;/ -find &plugin; -type f -iname "*.tar.gz" ! -iname "&name;-&version;.tar.gz" -delete + +# Verify and install plugin package +sum1=$(/usr/bin/md5sum &plgpath;/&plgname;.txz) +sum2=$(/usr/bin/cat &plgpath;/&plgname;.md5) +if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then + echo "Wrong 'plugin' package md5 hash." + rm &plgpath;/&plgname;.txz + rm &plgpath;/&plgname;.md5 + exit 1 +else + upgradepkg --install-new &plgpath;/&plgname;.txz +fi + +# Update file permissions of scripts chmod +0755 /usr/local/emhttp/plugins/&name;/scripts/* + +# add menu to VM Manager sed -i -- 's/OtherSettings/VMManager:1/g' /usr/local/emhttp/plugins/dynamix.vm.manager/VMSettings.page +#restart event daemon +&emhttp;/scripts/stop +sleep 1 +&emhttp;/scripts/start + +# Cleaning old source files +find &plgpath;/ -type f -iname "&name;*.txz" ! -iname "*&version;*" -delete +find &plgpath;/ -type f -iname "&name;*.md5" ! -iname "*&version;*" -delete + echo "" echo "-----------------------------------------------------------" echo " &name; has been installed." @@ -97,9 +131,13 @@ The 'remove' script. --> -/usr/local/emhttp/plugins/&name;/scripts/stop -rm -rf /usr/local/emhttp/plugins/&name; -rm -f &plugin;/&name;-&version;.tar.gz +&emhttp;/scripts/stop +removepkg &plgpath;/&plgname;.txz +rm -rf &emhttp; +rm -f &plgpath;/&plgname;.txz +rm -f &plgpath;/&plgname;.md5 + +# restore VM Manager Menu sed -i -- 's/VMManager:1/OtherSettings/g' /usr/local/emhttp/plugins/dynamix.vm.manager/VMSettings.page echo "" @@ -112,16 +150,4 @@ echo "" - - -> "$CFGFILE" -rm /tmp/libvirtwol-chkconf -]]> - - -