added GitHub API check

- use GitHub API to detect latest version from selected package
- save md5 in packages directory
This commit is contained in:
2022-07-21 07:21:13 +02:00
parent 24c03de6da
commit afe698d425

View File

@@ -2,7 +2,7 @@
<!DOCTYPE PLUGIN [ <!DOCTYPE PLUGIN [
<!ENTITY name "sound-driver"> <!ENTITY name "sound-driver">
<!ENTITY author "ich777"> <!ENTITY author "ich777">
<!ENTITY version "2022.07.20"> <!ENTITY version "2022.07.21">
<!ENTITY launch "Settings/sound-driver"> <!ENTITY launch "Settings/sound-driver">
<!ENTITY gitURL "https://github.com/&author;/unraid-&name;/raw/master"> <!ENTITY gitURL "https://github.com/&author;/unraid-&name;/raw/master">
<!ENTITY pluginURL "&gitURL;/&name;.plg"> <!ENTITY pluginURL "&gitURL;/&name;.plg">
@@ -15,6 +15,10 @@
<CHANGES> <CHANGES>
###2022.07.21
- Version detection from package via GitHub API
- Save md5 in packages directory
###2022.07.20 ###2022.07.20
- Necessary changes for unRAID 6.11+ - Necessary changes for unRAID 6.11+
- Cleanup - Cleanup
@@ -54,8 +58,9 @@ This package contains the Sound Drivers (and also a custom ALSA build) that enab
download() { download() {
# Download Sound Driver # Download Sound Driver
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${PACKAGE}-1.txz" "${DL_URL}/${PACKAGE}-1.txz" ; then if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}" "${DL_URL}/${LAT_PACKAGE}" ; then
if [ "$(md5sum "&packages;/${KERNEL_V%%-*}/${PACKAGE}-1.txz" | cut -d ' ' -f1)" != "$(wget -qO- "${DL_URL}/${PACKAGE}-1.txz.md5" | cut -d ' ' -f1)" ]; then wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5" "${DL_URL}/${LAT_PACKAGE}.md5"
if [ "$(md5sum &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE} | awk '{print $1}')" != "$(cat &packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}.md5 | awk '{print $1}')" ]; then
echo echo
echo "---CHECKSUM ERROR!---" echo "---CHECKSUM ERROR!---"
rm -rf &plugin; &emhttp; rm -rf &plugin; &emhttp;
@@ -72,18 +77,12 @@ fi
} }
check() { check() {
if [ ! -f "&packages;/${KERNEL_V%%-*}/${PACKAGE}-1.txz" ]; then if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then
LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/ich777/unraid-sound-driver/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
echo echo
echo "--------------------------Downloading Sound Drivers--------------------------" echo "--------------------------Downloading Sound Drivers--------------------------"
echo "---------This could take some time, please don't close this window!----------" echo "---------This could take some time, please don't close this window!----------"
download download
elif [ ! -s "&packages;/${KERNEL_V%%-*}/${PACKAGE}-1.txz" ]; then
rm -rf &packages;/${KERNEL_V%%-*}/${PACKAGE}-1.txz
echo
echo "----Download is empty please contact the developer of this plugin if the-----"
echo "----------plugin has been already built against that Kernel version----------"
rm -rf &plugin; &emhttp;
exit 1
else else
echo echo
echo "-------------------------Sound Drivers found locally-------------------------" echo "-------------------------Sound Drivers found locally-------------------------"
@@ -92,7 +91,7 @@ fi
install() { install() {
# Install Sound Drivers # Install Sound Drivers
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}-1.txz" /sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
depmod -a 2>/dev/null depmod -a 2>/dev/null
sleep 1 sleep 1
udevadm control --reload 2>/dev/null &amp;&amp; udevadm trigger --action=add 2>/dev/null udevadm control --reload 2>/dev/null &amp;&amp; udevadm trigger --action=add 2>/dev/null
@@ -121,7 +120,7 @@ echo -n "$(aplay -L | grep "CARD")" > /tmp/sound_outputs
# Define Variables # Define Variables
KERNEL_V="$(uname -r)" KERNEL_V="$(uname -r)"
PACKAGE="sound-plugin-${KERNEL_V}" PACKAGE="sound"
DL_URL="https://github.com/ich777/unraid-sound-driver/releases/download/$KERNEL_V" DL_URL="https://github.com/ich777/unraid-sound-driver/releases/download/$KERNEL_V"
if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then