Files
unraid-openrgb-patch/openrgb-patch.plg

138 lines
4.2 KiB
XML

<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "openrgb-patch">
<!ENTITY author "ich777">
<!ENTITY version "2025.02.07">
<!ENTITY gitURL "https://github.com/&author;/unraid-&name;/raw/master">
<!ENTITY pluginURL "&gitURL;/&name;.plg">
<!ENTITY plugin "/boot/config/plugins/&name;">
<!ENTITY emhttp "/usr/local/emhttp/plugins/&name;">
<!ENTITY packages "/boot/config/plugins/&name;/packages">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="&pluginURL;" min="6.9.2" max="7.1.0-beta.0.1" support="https://forums.unraid.net/topic/92865-support-ich777-amd-vendor-reset-coraltpu-hpsahba/">
<CHANGES>
###2025.02.07
- Set max version for plugin
###2022.07.21
- Version detection from package via GitHub API
- Save md5 in packages directory
###2022.07.19
- Necessary changes for unRAID 6.11+
- Cleanup
###2022.05.02
- Initial release
</CHANGES>
<FILE Name="&emhttp;/README.md">
<INLINE>
**OpenRGB Patch**
This package contains and installs the OpenRGB Patch that needs to be installed in conjunction with the OpenRGB Docker container to take full controll over your RGB lighting.
To see all the RGB devices you have to pass through the devices /sys/bus/i2c/device and /dev/i2c-0 to the OpenRGB Docker container and maybe all other /dev/i2c-X devices (where you have to replace X with the number from the device to pass through).
Source: https://gitlab.com/CalcProgrammer1/OpenRGB/-/blob/master/OpenRGB.patch
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
download() {
# Download OpenRGB-Patch
if wget -q -nc --show-progress --progress=bar:force:noscroll -O "&packages;/${KERNEL_V%%-*}/${LAT_PACKAGE}" "${DL_URL}/${LAT_PACKAGE}" ; 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 "---CHECKSUM ERROR!---"
rm -rf &plugin; &emhttp;
exit 1
fi
echo
echo "-------------------Sucessfully downloaded OpenRGB-Patch-------------------"
else
echo
echo "-----------------------Can't download OpenRGB-Patch-----------------------"
rm -rf &plugin; &emhttp;
exit 1
fi
}
check() {
if ! ls -1 &packages;/${KERNEL_V%%-*}/ | grep -q "${PACKAGE}" ; then
LAT_PACKAGE="$(wget -qO- https://api.github.com/repos/ich777/unraid-openrgb-patch/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
echo
echo "-----------------------Downloading OpenRGB-Patch!-------------------------"
echo "-------This could take some time, please don't close this window!---------"
download
else
echo
echo "-----------------------OpenRGB-Patch found locally------------------------"
fi
}
install() {
# Install OpenRGB-Patch
/sbin/modprobe -r i2c-piix4 2&gt;/dev/null
/sbin/modprobe -r i2c-nct6775 2&gt;/dev/null
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
depmod -a 2&gt;/dev/null
}
activate() {
# Modprobe drivers
/sbin/modprobe i2c-dev
/sbin/modprobe i2c-piix4
/sbin/modprobe i2c-nct6775
}
# Define Variables
KERNEL_V="$(uname -r)"
PACKAGE="openrgb_patch"
DL_URL="https://github.com/ich777/unraid-openrgb-patch/releases/download/$KERNEL_V"
if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then
mkdir -p "&packages;/${KERNEL_V%%-*}"
fi
# Check for old packages
rm -rf $(ls -d &packages;/* | grep -v "${KERNEL_V%%-*}")
#Check if OpenRGB-Patch is already downloaded/installed/activated
check
if [ ! "$(ls -1 /var/log/packages/ 2>/dev/null | grep "${PACKAGE}*")" ]; then
install > /dev/null
fi
activate
echo
echo "--------------Installation of OpenRGB-Patch successful-----------------"
echo
</INLINE>
</FILE>
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo "--------------------------------"
echo "---Uninstalling OpenRGB-Patch---"
echo "--------------------------------"
# Remove plugin related files
rm -rf &emhttp;
rm -rf &plugin;
echo
echo "-----------------------------------------------------------"
echo "---OpenRGB-Patch uninstalled, please reboot your server!---"
echo "-----------------------------------------------------------"
echo
</INLINE>
</FILE>
</PLUGIN>