update installation script
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
2022-05-07 04:23:07 +01:00
parent 1b6553c6e0
commit 66dbfbbec2
2 changed files with 78 additions and 26 deletions

View File

@@ -7,7 +7,7 @@
<!ENTITY gitURL "https://git.panaetius.co.uk/&org;/&name;"> <!ENTITY gitURL "https://git.panaetius.co.uk/&org;/&name;">
<!ENTITY pluginURL "&gitURL;/raw/branch/master/&name;.plg"> <!ENTITY pluginURL "&gitURL;/raw/branch/master/&name;.plg">
<!ENTITY releaseURL "&gitURL;/releases/download/&version;/&name;-&version;.txz"> <!ENTITY releaseURL "&gitURL;/releases/download/&version;/&name;-&version;.txz">
<!ENTITY md5 "2a6dde372dcf6c3a74bfa1c11d22875f"> <!ENTITY releaseMD5URL "&gitURL;/releases/download/&version;/md5sum.txt">
<!ENTITY plugin "/boot/config/plugins/&name;"> <!ENTITY plugin "/boot/config/plugins/&name;">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;"> <!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
]> ]>
@@ -22,26 +22,52 @@
</CHANGES> </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"> <FILE Run="/bin/bash">
<INLINE> <INLINE>
<!-- remove previous version if present --> local_package_file_md5=$(/usr/bin/md5sum &plugin;/&name;-&version;.txz)
file=$(/usr/bin/ls /boot/config/plugins/&name;/&name;*.txz | grep -v '&version;') remote_package_file_md5=$(/usr/bin/cat &name;-&version;.md5)
if [ ! -z "$file" ]
if test $local_package_file_md5 != remote_package_file_md5
then then
filename=$(basename -- $file) echo "*** md5 of download package does not match - removing files and exiting ***"
previous="${filename%.*}" rm &plugin;/&name;-&version;.txz
echo "previous version ${previous} found - uninstalling" rm &name;-&version;.md5
removepkg $previous exit 1
rm -f $file
else else
echo "no previous version found - first time install" echo "*** md5 check successful ***"
fi fi
</INLINE> </INLINE>
</FILE> </FILE>
<FILE Name="/boot/config/plugins/&name;/&name;-&version;.txz" Run="upgradepkg --install-new"> <FILE Run="/bin/bash">
<URL>&releaseURL;</URL> <INLINE>
<MD5>&md5;</MD5> <!-- 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>
<FILE Name="&emhttp;/README.md"> <FILE Name="&emhttp;/README.md">

View File

@@ -7,7 +7,7 @@
<!ENTITY gitURL "https://github.com/&org;/&name;"> <!ENTITY gitURL "https://github.com/&org;/&name;">
<!ENTITY pluginURL "&gitURL;/raw/master/&name;.plg"> <!ENTITY pluginURL "&gitURL;/raw/master/&name;.plg">
<!ENTITY releaseURL "&gitURL;/releases/download/&version;/&name;-&version;.txz"> <!ENTITY releaseURL "&gitURL;/releases/download/&version;/&name;-&version;.txz">
<!ENTITY md5 "2a6dde372dcf6c3a74bfa1c11d22875f"> <!ENTITY releaseMD5URL "&gitURL;/releases/download/&version;/md5sum.txt">
<!ENTITY plugin "/boot/config/plugins/&name;"> <!ENTITY plugin "/boot/config/plugins/&name;">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;"> <!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
]> ]>
@@ -21,26 +21,52 @@
</CHANGES> </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"> <FILE Run="/bin/bash">
<INLINE> <INLINE>
<!-- remove previous version if present --> local_package_file_md5=$(/usr/bin/md5sum &plugin;/&name;-&version;.txz)
file=$(/usr/bin/ls /boot/config/plugins/&name;/&name;*.txz | grep -v '&version;') remote_package_file_md5=$(/usr/bin/cat &name;-&version;.md5)
if [ ! -z "$file" ]
if test $local_package_file_md5 != remote_package_file_md5
then then
filename=$(basename -- $file) echo "*** md5 of download package does not match - removing files and exiting ***"
previous="${filename%.*}" rm &plugin;/&name;-&version;.txz
echo "previous version ${previous} found - uninstalling" rm &name;-&version;.md5
removepkg $previous exit 1
rm -f $file
else else
echo "no previous version found - first time install" echo "*** md5 check successful ***"
fi fi
</INLINE> </INLINE>
</FILE> </FILE>
<FILE Name="/boot/config/plugins/&name;/&name;-&version;.txz" Run="upgradepkg --install-new"> <FILE Run="/bin/bash">
<URL>&releaseURL;</URL> <INLINE>
<MD5>&md5;</MD5> <!-- 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>
<FILE Name="&emhttp;/README.md"> <FILE Name="&emhttp;/README.md">