update install script
Some checks failed
continuous-integration/drone/tag Build is failing

This commit is contained in:
2022-05-07 04:17:56 +01:00
parent 557ff09198
commit 6034285ab6
2 changed files with 78 additions and 26 deletions

View File

@@ -7,7 +7,7 @@
<!ENTITY gitURL "https://github.com/&org;/&name;">
<!ENTITY pluginURL "&gitURL;/raw/master/&name;.plg">
<!ENTITY releaseURL "&gitURL;/releases/download/&version;/&name;-&version;.txz">
<!ENTITY md5 "b49a912a3702d5704b6cecfcd8564d33">
<!ENTITY releaseMD5URL "&gitURL;/releases/download/&version;/md5sum.txt">
<!ENTITY plugin "/boot/config/plugins/&name;">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
]>
@@ -20,26 +20,52 @@
</CHANGES>
<FILE Name="&plugin;/&name;-&version;.txz">
<URL>&releaseURL;</URL>
</FILE>
<FILE Name="&plugin;/&name;-&version;.md5">
<URL>&releaseMD5URL;</URL>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
<!-- remove previous version if present -->
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
</INLINE>
</FILE>
<FILE Name="/boot/config/plugins/&name;/&name;-&version;.txz" Run="upgradepkg --install-new">
<URL>&releaseURL;</URL>
<MD5>&md5;</MD5>
<FILE Run="/bin/bash">
<INLINE>
<!-- remove previous version if present -->
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
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
upgradepkg --install-new &plugin;/&name;-&version;.txz
</INLINE>
</FILE>
<FILE Name="&emhttp;/README.md">