230 lines
7.4 KiB
XML
230 lines
7.4 KiB
XML
<?xml version='1.0' standalone='yes'?>
|
|
<!DOCTYPE PLUGIN [
|
|
<!ENTITY name "nct6687-driver">
|
|
<!ENTITY author "ich777">
|
|
<!ENTITY version "2025.05.12">
|
|
<!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.0">
|
|
|
|
<CHANGES>
|
|
|
|
###2025.05.12
|
|
- Prevent installation from NCT6683 module on boot
|
|
|
|
###2025.04.25
|
|
- Blacklist NCT6683 module on installation
|
|
|
|
###2024.07.10
|
|
- Add Plugin Update Helper to ensure driver package is downloaded ahead of time when unRAID is updated
|
|
|
|
###2022.07.21
|
|
- Version detection from package via GitHub API
|
|
- Save md5 in packages directory
|
|
|
|
###2021.07.30
|
|
- Removed max version 6.10.0-beta25a
|
|
|
|
###2021.07.29
|
|
- Added max version 6.10.0-beta25a
|
|
|
|
###2021.06.22
|
|
- Changed package download
|
|
- Fixed icon not sowing up
|
|
|
|
###2021.03.25
|
|
- Added wait for network and timout
|
|
|
|
###2021.03.24
|
|
- Integrated icon into package
|
|
|
|
###2021.03.02
|
|
- Initial release
|
|
|
|
</CHANGES>
|
|
|
|
<FILE Run="/bin/bash">
|
|
<INLINE>
|
|
rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null|grep -v '&version;')
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Name="&emhttp;/README.md">
|
|
<INLINE>
|
|
**Nuvoton NCT6687 Driver**
|
|
|
|
This package contains the NCT6687 Drivers and installs them for using it with the Dynamix System Temperature Plugin.
|
|
|
|
Source: https://github.com/Fred78290/nct6687d
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash">
|
|
<INLINE>
|
|
|
|
#Check if NCT6683 module is blacklisted and installation is prevented if not blacklist it and prevent installation
|
|
if [ ! -d /boot/config/modprobe.d ]; then
|
|
mkdir -p /boot/config/modprobe.d
|
|
fi
|
|
if [ ! "$(grep "blacklist" /boot/config/modprobe.d/nct6683.conf 2>/dev/null)" ]; then
|
|
echo "blacklist nct6683" >> /boot/config/modprobe.d/nct6683.conf
|
|
fi
|
|
if [ ! "$(grep "install nct6683 /bin/false" /boot/config/modprobe.d/nct6683.conf 2>/dev/null)" ]; then
|
|
echo "install nct6683 /bin/false" >> /boot/config/modprobe.d/nct6683.conf
|
|
fi
|
|
|
|
download() {
|
|
#Download NCT6687d Drivers
|
|
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 NCT6687d Drivers-------------------"
|
|
else
|
|
echo
|
|
echo "-----------------------Can't download NCT6687d Drivers-----------------------"
|
|
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-nct6687-driver/releases/tags/${KERNEL_V} | jq -r '.assets[].name' | grep "${PACKAGE}" | grep -E -v '\.md5$' | sort -V | tail -1)"
|
|
echo
|
|
echo "-----------------------Downloading NCT6687d Drivers!-------------------------"
|
|
echo "---------This could take some time, please don't close this window!----------"
|
|
download
|
|
else
|
|
echo
|
|
echo "-----------------------NCT6687d Drivers found locally------------------------"
|
|
fi
|
|
}
|
|
|
|
install() {
|
|
#Install NCT6687d Drivers
|
|
/sbin/installpkg "&packages;/${KERNEL_V%%-*}/${PACKAGE}*.txz"
|
|
depmod -a
|
|
}
|
|
|
|
activate() {
|
|
/sbin/modprobe nct6687
|
|
}
|
|
|
|
# Define Variables
|
|
KERNEL_V="$(uname -r)"
|
|
PACKAGE="nct6687d"
|
|
DL_URL="https://github.com/ich777/unraid-nct6687-driver/releases/download/$KERNEL_V"
|
|
|
|
if [ ! -d "&packages;/${KERNEL_V%%-*}" ]; then
|
|
mkdir -p "&packages;/${KERNEL_V%%-*}"
|
|
fi
|
|
|
|
if [ ! -f "&plugin;/&name;.png" ]; then
|
|
wget -q -nc -O "&plugin;/&name;.png" "https://raw.githubusercontent.com/ich777/docker-templates/master/ich777/images/nuvoton.png"
|
|
fi
|
|
|
|
#Check for old packages
|
|
rm -rf $(ls -d &packages;/* | grep -v "${KERNEL_V%%-*}")
|
|
|
|
#Check if NCT6687d Drivers are allready downloaded
|
|
check
|
|
|
|
if ! modinfo nct6687 -0 >/dev/null 2>&1 ; then
|
|
install > /dev/null
|
|
activate
|
|
else
|
|
activate
|
|
fi
|
|
|
|
#Install icon
|
|
if [ ! -f "&emhttp;/images/&name;.png" ]; then
|
|
if [ ! -d "&emhttp;/images" ]; then
|
|
mkdir -p &emhttp;/images
|
|
fi
|
|
cp &plugin;/&name;.png &emhttp;/images/
|
|
fi
|
|
|
|
|
|
#Check if Plugin Update Helper is downloaded and up-to-date
|
|
if [ ! -f &plugin;/plugin_update_helper ]; then
|
|
wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper"
|
|
else
|
|
CUR_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')"
|
|
if [ ! -s /tmp/update-helper ]; then
|
|
echo "$(wget -T5 -qO- https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper | grep -E "Plugin-Update-Helper version:" | awk '{print $4}')" > /tmp/update-helper
|
|
AVAIL_V="$(cat /tmp/update-helper)"
|
|
else
|
|
AVAIL_V="$(cat /tmp/update-helper)"
|
|
fi
|
|
if [ ! -z "$AVAIL_V" ]; then
|
|
COMPARE="$(sort -V <(echo -e "${AVAIL_V}\n$CUR_V") | tail -1)"
|
|
if [ "$CUR_V" != "$COMPARE" ]; then
|
|
wget -q -T 5 -O &plugin;/plugin_update_helper "https://raw.githubusercontent.com/ich777/unraid-plugin_update_helper/master/plugin_update_helper"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
#Check if Plugin Update Helper is installed and up to date
|
|
if [ ! -f /usr/bin/plugin_update_helper ]; then
|
|
cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper
|
|
chmod +x /usr/bin/plugin_update_helper
|
|
else
|
|
PLUGIN_V="$(grep -E "Plugin-Update-Helper version:" &plugin;/plugin_update_helper | awk '{print $4}')"
|
|
INST_V="$(grep -E "Plugin-Update-Helper version:" /usr/bin/plugin_update_helper | awk '{print $4}')"
|
|
COMPARE="$(sort -V <(echo -e "${PLUGIN_V}\n$INST_V") | tail -1)"
|
|
if [ "$INST_V" != "$COMPARE" ]; then
|
|
kill $(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}') 2>/dev/null
|
|
sleep 1
|
|
cp &plugin;/plugin_update_helper /usr/bin/plugin_update_helper
|
|
chmod +x /usr/bin/plugin_update_helper
|
|
fi
|
|
fi
|
|
|
|
#Start Plugin Update Helper
|
|
if [ -z "$(ps aux | grep -E "inotifywait -q /boot/changes.txt -e move_self,delete_self" | grep -v "grep -E inotifywait" | awk '{print $2}')" ]; then
|
|
echo "/usr/bin/plugin_update_helper" | at now > /dev/null 2>&1
|
|
fi
|
|
|
|
|
|
echo
|
|
echo "----------------Installation of NCT6687d Drivers successful------------------"
|
|
echo
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
|
|
<FILE Run="/bin/bash" Method="remove">
|
|
<INLINE>
|
|
|
|
echo "-----------------------------------"
|
|
echo "---Uninstalling NCT6687d Drivers---"
|
|
echo "-----------------------------------"
|
|
# Remove plugin related files
|
|
rm -rf &plugin; &emhttp;
|
|
# Remove blacklist
|
|
if [ "$(grep -vE "blacklist|/bin/false" /boot/config/modprobe.d/nct6683.conf 2>/dev/null)" ]; then
|
|
sed -i '/blacklist nct6683/d' /boot/config/modprobe.d/nct6683.conf 2>/dev/null
|
|
sed -i '/install nct6683 \/bin\/false/d' /boot/config/modprobe.d/nct6683.conf
|
|
else
|
|
rm -rf /boot/config/modprobe.d/nct6683.conf 2>/dev/null
|
|
fi
|
|
echo
|
|
echo "--------------------------------------------------------------"
|
|
echo "---NCT6687d Drivers uninstalled, please reboot your server!---"
|
|
echo "--------------------------------------------------------------"
|
|
echo
|
|
|
|
</INLINE>
|
|
</FILE>
|
|
</PLUGIN> |