<?xml version='1.0' standalone='yes'?>

<!DOCTYPE PLUGIN [
<!ENTITY name      "ewft.minidlna">
<!ENTITY author    "EWFT">
<!ENTITY version   "2021.01.17a">
<!ENTITY launch    "Settings/ewft.minidlna">
<!ENTITY pluginURL "https://git.ewft.org/Unraid/ewft.minidlna/raw/master/ewft.minidlna.plg">
<!ENTITY pkgURL    "https://git.ewft.org/Unraid/ewft.minidlna/raw/master/build/">
<!ENTITY minidlnapkg    "minidlna-1.3.0_static">
<!ENTITY minidlnaMD5       "338b106e1dd12d994be41d6815050ba5">
<!ENTITY plginpkg  "ewft.minidlna">
<!ENTITY plginMD5       "dfae62c8ea5675f5850a64113d6d1acf">
<!ENTITY menupkg  "ewft.menu">
<!ENTITY menupkgMD5       "56c7a49d0c1b6355b7ff99560d4a5b1e">
<!ENTITY pluginLoc "/boot/config/plugins/&name;">
]>

<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" min="6.4.0">

<CHANGES>
##&name;

###&version;

###2021.01.17
- Initial release

</CHANGES>

<!-- PRE-INSTALL SCRIPT -->
<FILE Run="/bin/bash">
<INLINE>
</INLINE>
</FILE>

<!-- SOURCE PACKAGE -->
<FILE Name="&pluginLoc;/&minidlnapkg;.txz" Run="upgradepkg --install-new --reinstall">
<URL>&pkgURL;&minidlnapkg;.txz</URL>
<MD5>&minidlnaMD5;</MD5>
</FILE>

<FILE Name="&pluginLoc;/&plginpkg;.txz" Run="upgradepkg --install-new --reinstall">
<URL> &pkgURL;&plginpkg;.txz</URL>
<MD5>&plginMD5;</MD5>
</FILE>

<FILE Name="&pluginLoc;/&menupkg;.txz" Run="upgradepkg --install-new --reinstall">
<URL> &pkgURL;&menupkg;.txz</URL>
<MD5>&menupkgMD5;</MD5>
</FILE>

<FILE Name="&pluginLoc;/minidlna.conf" Run="upgradepkg --install-new --reinstall">
<URL>https://git.ewft.org/Unraid/ewft.minidlna/raw/master/minidlna.conf</URL>
</FILE>

<FILE Name="/boot/config/plugins/&name;/&name;.cfg">
<INLINE>
<![CDATA[
# EWFT MiniDLNA
SERVICE="enable"
]]>
</INLINE>
</FILE>

<!-- POST-INSTALL SCRIPT -->
<FILE Run="/bin/bash">
<INLINE>

cp /boot/config/plugins/&name;/minidlna.conf /etc/

[ -e "/etc/rc.d/rc.ewft.minidlna" ] &amp;&amp; rm -f "/etc/rc.d/rc.ewft.minidlna"
ln -s "/usr/local/emhttp/plugins/ewft.minidlna/scripts/rc.ewft.minidlna" "/etc/rc.d/rc.ewft.minidlna"


echo ""
echo "-----------------------------------------------------------"
echo " Plugin &name; is installed."
echo " Version: &version;"
echo "-----------------------------------------------------------"
echo ""
</INLINE>
</FILE>

<!-- REMOVE SCRIPT -->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
# Remove plugin related files
rm -rf /etc/minidlna.conf
rm -f "/etc/rc.d/rc.ewft.minidlna"


# Uninstall the 'source' package
removepkg minidlna-1.3.0_static
removepkg ewft.minidlna
removepkg ewft.menu
</INLINE>
</FILE>

</PLUGIN>
